Skip to main content

Get Started with Microsoft Agent Framework Declarative

Please install this package via pip:

pip install agent-framework-declarative

Release stage

This package ships at two different stability levels:

  • Declarative workflows (WorkflowFactory, executors, handlers, and the _workflows surface) are stable.
  • Declarative agents (AgentFactory and the YAML agent loading/parsing path: DeclarativeLoaderError, ProviderLookupError, ProviderTypeMapping) are experimental and may change or be removed in future versions without notice. Using any of these symbols emits an ExperimentalWarning on first use.

Declarative features

The declarative packages provides support for building agents based on a declarative yaml specification.

HTTP request client ownership and cookies

Breaking change: The HTTP client created by DefaultHttpRequestHandler no longer persists response cookies. The handler still creates its client lazily, reuses it across requests and workflows, and closes it on aclose() or async context-manager exit. Timeout and redirect defaults are unchanged.

Applications requiring cookies for authentication, session continuity, or load-balancer affinity must supply an httpx.AsyncClient through client= or client_provider=. Supplied and provider-returned clients retain their configuration and cookie behavior and must be closed by the caller. Scope cookie-bearing clients to one authenticated principal; sharing a handler across workflows does not partition a client's cookies. A provider returning None falls back to client=, if supplied, then to the internally owned client with the default cookie policy.

Explicit Cookie request headers remain supported. Response Set-Cookie headers remain available in HttpRequestResult.headers; disabling persistence does not redact the response.

MCP handler session lifetime

DefaultMCPToolHandler() reuses MCP sessions through a bounded LRU cache. When configured with client_provider, it instead invokes the provider and creates a fresh MCP tool/session for every invocation, including tools/list. Sessions are never reused in this mode, even if the provider returns None or the same httpx.AsyncClient instance.

Each invocation closes its tool/session on success, failure, or cancellation. Internally created fallback HTTP clients are also closed; caller-supplied HTTP clients remain caller-owned and are never closed by the handler. Calling aclose() rejects new invocations and waits for active provider-backed invocations to finish cleaning up. Calling it from an active invocation's context (including provider callbacks, inherited child tasks, and cleanup) raises RuntimeError before changing handler state, rather than waiting on itself. Close the handler outside that context or after the invocation completes.

This intentionally incurs connection and initialization overhead and does not retain server session state between provider-backed invocations. Applications that require shared session ownership must implement an explicitly scoped custom MCPToolHandler; there is no provider-backed session-cache opt-in.

Metadata

Release files for agent-framework-declarative 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-framework-declarative 1.2.0
File Size Uploaded
agent_framework_declarative-1.2.0.tar.gz 103.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-framework-declarative 1.2.0
File Interpreter ABI Platform
agent_framework_declarative-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 220.4 kB

Release files / agent_framework_declarative-1.2.0.tar.gz

Download URL agent_framework_declarative-1.2.0.tar.gz
Size 103.3 kB
Tags Source
SHA-256 checksum
How to use checksums
30ba577b8b5ca53789f89efacccc8bc814d248e73a1221261c6492c17e1b9d98
BLAKE2b-256 checksum
How to use checksums
4e4117fa18e26f82c570a77daccddc158cce9c51baa5ed25bacc77a83b054f21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / agent_framework_declarative-1.2.0-py3-none-any.whl

Download URL agent_framework_declarative-1.2.0-py3-none-any.whl
Size 117.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a21e820949a2d613fc6e9ff94bb555445e15f975230f0f8b5b69c864098b16b
BLAKE2b-256 checksum
How to use checksums
519a382a1fa20e89e950f453998b3dd7ce2cc67e4192a4a865b5547af71e70f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page