agentleFS
MicrosoftKnown publishermicrosoft/agent-framework/python/packages/openai/AGENTS.md

agent-framework / openai

AGENTS.md14k starsChanged 10 months agoMITView on GitHub

OpenAI integration package for Agent Framework. Contains OpenAI Responses API and Chat Completions API clients. All clients follow the Raw + Full-Featured pattern (e.g., RawOpenAIChatClient + OpenAIChatClient). For Responses API continuation with service-side storage, a prior hosted function_approval_request is server-issued and must not be replayed inline, while the new hosted function_approval_response is serialized as mcp_approval_response so the user's approved or rejected decision reaches the service. Local FunctionTool approval controls are resolved in-process and must not be serialized as MCP items.…

  • Reads credentials

Trending

More talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 0 mentionsFeb 2026: 1 mentionMar 2026: 3 mentionsApr 2026: 5 mentionsMay 2026: 3 mentionsJun 2026: 1 mentionJul 2026: 1 mentionAug 2026: 1 mentionSep 2026: 3 mentionsOct 2026: 1 mentionNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/agent-framework repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/agent-framework

The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 31

Talked about on GitHub, Bluesky and Hacker News (31 times).

On GitHub · 17

12 more on GitHub

On Bluesky · 10

5 more on Bluesky

The file

We split this AGENTS.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All clients follow the Raw + Full-Featured pattern (e.g., RawOpenAIChatClient + OpenAIChatClient).

    line 25

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — agent-framework-openai

OpenAI integration package for Agent Framework. Contains OpenAI Responses API and Chat Completions API clients.

Package Structure

agent_framework_openai/
├── __init__.py                 # Public API exports
├── _chat_client.py             # OpenAIChatClient (Responses API) + RawOpenAIChatClient
├── _chat_completion_client.py  # OpenAIChatCompletionClient (Chat Completions API) + RawOpenAIChatCompletionClient
├── _embedding_client.py        # OpenAIEmbeddingClient
├── _exceptions.py              # OpenAI-specific exceptions
└── _shared.py                  # OpenAISettings and shared config helpers

Key Classes

ClassAPIStatus
OpenAIChatClientResponses APIPrimary
OpenAIChatCompletionClientChat Completions APIPrimary
OpenAIEmbeddingClientEmbeddings APIPrimary

All clients follow the Raw + Full-Featured pattern (e.g., RawOpenAIChatClient + OpenAIChatClient).

For Responses API continuation with service-side storage, a prior hosted function_approval_request is server-issued and must not be replayed inline, while the new hosted function_approval_response is serialized as mcp_approval_response so the user's approved or rejected decision reaches the service. Local FunctionTool approval controls are resolved in-process and must not be serialized as MCP items. An approval is hosted when its function call carries a server_label in function_call.additional_properties; approvals without that metadata are local. Applications that manually replay message history must not send that same hosted approval response again on later turns.

The generic OpenAI clients support both OpenAI and Azure OpenAI routing. Precedence is: explicit Azure inputs (credential, azure_endpoint, api_version) → OpenAI API key (OPENAI_API_KEY) → Azure environment fallback (AZURE_OPENAI_*).

Adapting the Chat Completions client to OpenAI-compatible endpoints

OpenAIChatCompletionClient targets the OpenAI Chat Completions wire format and is intentionally kept free of provider-specific quirks. Many "OpenAI-compatible" providers (OpenRouter, vLLM, Mistral, DeepSeek, Ollama, …) diverge on the edges — e.g. returning reasoning under reasoning / reasoning_content / reasoning_details, or content as a list of chunks. Rather than branching in core, the client exposes two optional callables so callers adapt it themselves:

  • response_parser: OpenAIChatResponseContentsParser — (message_or_delta, default_contents) -> contents. Post-processes the Content items parsed from each response choice. Receives the already-selected ChatCompletionMessage (non-streaming) or ChoiceDelta (streaming) — the client resolves the dispatch — so a parser reads provider fields directly (e.g. getattr(msg, "reasoning", None)) without branching. Use it to surface non-standard fields for display. Applied per choice in both paths.
  • message_preparer: OpenAIChatMessagePreparer — (message, default_dicts) -> dicts. Post-processes the outgoing request message dicts built from each framework Message (called once per Message, for every role including system/developer). Use it to echo provider-specific fields (e.g. vLLM reasoning) back on later turns for multi-turn continuity. To correlate a surfaced-reasoning Content with the dict the default serializer emitted for it, tag the Content via additional_properties in the parser and match against message.contents rather than raw request-string matching.

Both default to None (no-op → byte-identical stock OpenAI behavior) and are constructor args on RawOpenAIChatCompletionClient / OpenAIChatCompletionClient. Provider round-trips generally need both: the parser surfaces the field for display, the preparer sends it back. Prefer a dedicated client (e.g. agent-framework-mistral) when an endpoint diverges substantially.

Native Responses and Chat Completions refusals remain ordinary text content with the experimental additional_properties["model_output_kind"] == "refusal" marker. Assistant history reconstructs the provider's native refusal field without splitting mixed text/refusal turns; non-assistant marked text is sent as ordinary input text.

Responses citations remain Content.annotations, including annotation-only updates parsed from completed text parts and output messages. Streaming deduplication is request-local and keyed by item ID, content index, and annotation index, so separate references to the same URL remain distinct. _parse_chunk_from_openai retains the signature overridden by released Foundry clients.

Dependencies

  • agent-framework-core — core abstractions
  • openai — OpenAI Python SDK

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.