- Rename UserNameProvider → UserMemoryProvider
- Use session state (state dict) instead of instance variables
- Use context.extend_instructions() instead of context.instructions.append()
- Use DEFAULT_SOURCE_ID class attribute
- Fix imports to use public agent_framework API
- Add session state inspection at end of sample
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg
·
2026-02-19 15:34:49 +00:00
* Python: improve .env precedence and observability samples
- Switch load_settings to explicit precedence: overrides -> explicit .env -> environment -> defaults\n- Raise when env_file_path is provided but missing\n- Update settings docs and tests for new behavior\n- Refresh observability samples and README guidance for env loading options\n\nCloses #3864\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fixed some imports
* Fix load_settings CI regressions
Allow explicit env_file_path values that exist but are not regular files (for example /dev/null) by checking path existence before dotenv parsing, and restore a dict accumulator with typed return cast to satisfy mypy.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Avoid implicit dotenv in observability
Only load dotenv in observability helpers when env_file_path is explicitly provided, and remove test os.devnull workarounds that are no longer necessary.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg
·
2026-02-18 11:18:52 +00:00
* Fix streaming branch in weather override middleware sample
The streaming branch of weather_override_middleware only prefixed the
original weather data via a transform hook instead of replacing the
content with the 'perfect weather' override like the non-streaming
branch does. Replace with a new ResponseStream that yields the override
content as ChatResponseUpdate chunks.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fixed exception handling middleware sample
* Fixed runtime context delegation middleware example
* Fixed multimodal input examples
* Small update
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add workflow support for Azure Functions
* fix compatability with latest framework changes and add integration tests
* refactor code
* remove white space
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* align help text with actual port used
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* replace instance id with a place holder
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* remove unused import
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* remove redundant typing import and fix SIM115
* fix latest breaking changes
* fix mypy issues
* clean up imports
* define source marker strings as constants
* fix json module name
* refactor _extract_message_content_from_dict
* refactor serialization
* add helper method for error response construction and remove _extract_message_content_from_dict since it is not needed
* use strict tpe checking for edges
* change how duplicate agent registrations are handled
* cancel approval_task on HITL timeout
* update docstring
* fix: align azurefunctions package with core API changes after rebase
- State.import_state/export_state are now sync (removed await)
- Add State.commit() before export_state() in activity execution
- Rename executor parameter shared_state -> state
- Rename ctx.set_shared_state/get_shared_state -> set_state/get_state (sync)
- WorkflowBuilder now takes start_executor as constructor kwarg
- Update WorkflowOutputEvent -> WorkflowEvent with type='output'
- Update RequestInfoEvent -> WorkflowEvent[Any]
- Update SharedState -> State in test imports
- Update duplicate agent name tests to match new warning behavior
- Update sample README API references
* fix sample check errors
* fix mypy issues
* fix trailing white spaces
* fix test imports
* feat: add durable workflow samples and adapt to main branch changes
- Add workflow samples 09-12 to 04-hosting/azure_functions/
- Adapt to ChatMessage -> Message rename from main
- Adapt to pickle-based checkpoint encoding from main
- Simplify _serialization.py to delegate to core encode/decode
- Fix Message -> WorkflowMessage disambiguation in _context.py
- Remove non-existent _checkpoint_summary import
* fix: update create_checkpoint signature to match superclass
* fix: correct relative link in HITL sample README
* fix: resolve import breakage after rebase (State, DurableAgentThread, get_logger)
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
* feat: Inject OpenTelemetry trace context into MCP requests and update documentation
* Update python/samples/getting_started/observability/README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update python/packages/core/tests/core/test_mcp.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* refactor: move opentelemetry import to module level
OpenTelemetry is a hard dependency of agent-framework-core (per
pyproject.toml), so the try/except ImportError guard was dead code.
Move the import to the top of the file to fail fast on missing
dependencies instead of silently hiding installation issues.
---------
Co-authored-by: Pete Roden <Pete.Roden@microsoft.com>
Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix#3600: Pass JSON schemas through without Pydantic conversion
This change optimizes FunctionTool and MCP flows by passing JSON schemas
directly to providers without converting them to Pydantic models first.
Key changes:
- Store JSON schema as-is when supplied to FunctionTool
- Skip Pydantic model_validate for schema-supplied tools in invoke()
- Return MCP tool schemas directly without conversion
- Add comprehensive tests for schema passthrough behavior
Performance benefits:
- Eliminates expensive Pydantic model creation for supplied schemas
- Preserves exact schema structure (additionalProperties, custom fields, etc.)
- Reduces memory overhead and initialization time
Maintains backward compatibility:
- Function signature inference still uses Pydantic models
- Explicit Pydantic models passed as input_model work as before
- All existing tests pass
* Fix schema passthrough validation and remove helper
* Simplify FunctionTool without generic model dependency
* Fix FunctionTool typing fallout in 3600
* Remove FunctionTool[Any] compatibility shim
* Use serializable kwargs in OTEL tool args
Eduard van Valkenburg
·
2026-02-14 10:12:21 +00:00
* Python: Replace wildcard imports with explicit imports
- Replace all 'from ... import *' with explicit symbol imports
- Add __all__ declarations to namespace packages for re-exports
- Update CODING_STANDARD.md to prohibit wildcard imports
- Maintain exported API and preserve all functionality
fixes#3605
* Refine wildcard guidance example text
* Simplify explicit exports without self-aliases
Eduard van Valkenburg
·
2026-02-13 14:02:36 +00:00
* fix: prevent repeating instructions in continued Responses API conversations
- Instructions are now only prepended to messages on the first turn
- When conversation_id/response_id exists (continuation), instructions are skipped
- Covers OpenAI and Azure Responses API paths
- Adds regression tests for all continuation scenarios
Fixes#3498
* Apply lint fixes to continuation tests
* Consolidate responses continuation tests
Eduard van Valkenburg
·
2026-02-13 13:34:15 +00:00
* PR2: Wire context provider pipeline and update all internal consumers
- Replace AgentThread with AgentSession across all packages
- Replace ContextProvider with BaseContextProvider across all packages
- Replace context_provider param with context_providers (Sequence)
- Replace thread= with session= in run() signatures
- Replace get_new_thread() with create_session()
- Add get_session(service_session_id) to agent interface
- DurableAgentThread -> DurableAgentSession
- Remove _notify_thread_of_new_messages from WorkflowAgent
- Wire before_run/after_run context provider pipeline in RawAgent
- Auto-inject InMemoryHistoryProvider when no providers configured
* fix: update all tests for context provider pipeline, fix lazy-loaders, remove old test files
* refactor: update all sample files for context provider pipeline (AgentThread→AgentSession, ContextProvider→BaseContextProvider)
* fix: update remaining ag-ui references (client docstring, getting_started sample)
* fix: make get_session service_session_id keyword-only to avoid confusion with session_id
* refactor: rename _RunContext.thread_messages to session_messages
* refactor: remove _threads.py, _memory.py, and old provider files; migrate devui to use plain message lists
* rename: remove _new_ prefix from test files
* refactor: rewrite SlidingWindowChatMessageStore as SlidingWindowHistoryProvider(InMemoryHistoryProvider)
* fix: read full history from session state directly instead of reaching into provider internals
* fix: update stale .pyi stubs, sample imports, and README references for new provider types
* fix: remove stale message_store, _notify_thread_of_new_messages, and session_id.key references in samples
* refactor: merge context_providers and sessions sample folders into sessions, remove aggregate_context_provider
* refactor: UserInfoMemory stores state in session.state instead of instance attributes
* feat: add Pydantic BaseModel support to session state serialization
Pydantic models stored in session.state are now automatically serialized
via model_dump() and restored via model_validate() during to_dict()/from_dict()
round-trips. Models are auto-registered on first serialization; use
register_state_type() for cold-start deserialization.
Also export register_state_type as a public API.
* fix mem0
* Update sample README links and descriptions for session terminology
- Replace 'thread' with 'session' in sample descriptions across all READMEs
- Update file links for renamed samples (mem0_sessions, redis_sessions, etc.)
- Fix Threads section → Sessions section in main samples/README.md
- Update tools, middleware, workflows, durabletask, azure_functions READMEs
- Update architecture diagrams in concepts/tools/README.md
- Update migration guides (autogen, semantic-kernel)
* Fix broken Redis README link to renamed sample
* Fix Mem0 OSS client search: pass scoping params as direct kwargs
AsyncMemory (OSS) expects user_id/agent_id/run_id as direct kwargs,
while AsyncMemoryClient (Platform) expects them in a filters dict.
Adds tests for both client types.
Port of fix from #3844 to new Mem0ContextProvider.
* Fix rebase issues: restore missing _conversation_state.py and checkpoint decode logic
- Add back _conversation_state.py (encode/decode_chat_messages) lost in rebase
- Fix on_checkpoint_restore to decode cache/conversation with decode_chat_messages
- Fix on_checkpoint_restore to use decode_checkpoint_value for pending requests
- Add tests/workflow/__init__.py for relative import support
- Fix test_agent_executor checkpoint selection (checkpoints[1] not superstep)
* Add STORES_BY_DEFAULT ClassVar to skip redundant InMemoryHistoryProvider injection
Chat clients that store history server-side by default (OpenAI Responses API,
Azure AI Agent) now declare STORES_BY_DEFAULT = True. The agent checks this
during auto-injection and skips InMemoryHistoryProvider unless the user
explicitly sets store=False.
* Fix broken markdown links in azure_ai and redis READMEs
* Fix getting-started samples to use session API instead of removed thread/ContextProvider API
* updates to workflow as agent
* fix group chat import
* Rename Thread→Session throughout, fix service_session_id propagation, remove stale AGUIThread
- Fix: Propagate conversation_id from ChatResponse back to session.service_session_id
in both streaming and non-streaming paths in _agents.py
- Rename AgentThreadException → AgentSessionException
- Remove stale AGUIThread from ag_ui lazy-loader
- Rename use_service_thread → use_service_session in ag-ui package
- Rename test functions from *_thread_* to *_session_*
- Rename sample files from *_thread* to *_session*
- Update docstrings and comments: thread → session
- Update _mcp.py kwargs filter: add 'session' alongside 'thread'
- Fix ContinuationToken docstring example: thread=thread → session=session
- Fix _clients.py docstring: 'Agent threads' → 'Agent sessions'
* Fix broken markdown links after thread→session file renames
* fix azure ai test
Eduard van Valkenburg
·
2026-02-12 21:00:32 +00:00
* restructure: Python samples into progressive 01-05 layout
- 01-get-started/: 6 numbered steps (hello agent → hosting)
- 02-agents/: all agent concept samples (tools, middleware, providers, etc.)
- 03-workflows/: ALL existing workflow samples preserved as-is
- 04-hosting/: azure-functions, durabletask, a2a
- 05-end-to-end/: demos, evaluation, hosted agents
- Old files moved to _to_delete/ for review
- Added AGENTS.md with structure documentation
- autogen-migration/ and semantic-kernel-migration/ preserved at root
* fix: switch to AzureOpenAI Foundry, fix CI failures
- Switch all 01-get-started samples to AzureOpenAIResponsesClient with
Azure AI Foundry project endpoint (AZURE_AI_PROJECT_ENDPOINT +
AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME + AzureCliCredential)
- Add _to_delete/ and 05-end-to-end/ to pyrightconfig.samples.json excludes
- Fix test paths in packages/ that referenced old getting_started/ dirs:
durabletask conftest + streaming test, azurefunctions conftest,
devui conftest + capture_messages + openai_sdk_integration
- Fix workflow_as_agent_human_in_the_loop.py import (sibling import)
- Update hosting READMEs and tool comment paths
- Replace root README.md with new structure overview
- Update AGENTS.md to document Azure OpenAI Foundry as default provider
* cleanup: remove _to_delete folder, copy resource files to active dirs
All files in _to_delete/ were either:
- Exact duplicates of files in the new structure (240 files)
- Same file with only comment path updates (100 files)
- One import-fix diff (workflow_as_agent_human_in_the_loop.py)
- One superseded minimal_sample.py
Resource files (sample.pdf, countries.json, employees.pdf, weather.json)
copied to 02-agents/sample_assets/ and 02-agents/resources/ since active
samples reference them.
* fix: address PR review comments, centralize resources, remove root duplicates
- Fix type annotation in 04_memory.py (string union -> proper types)
- Fix old sample paths in observability files
- Fix grammar/spelling in observability samples
- Move sample_assets/ and resources/ to shared/ folder
- Remove 8 duplicate observability files from 02-agents root
- Update resource path references in multimodal_input and provider samples
* fix: update broken links from old getting_started paths to new structure
- Update relative paths in READMEs: getting_started/ → 01-get-started/,
02-agents/, 03-workflows/, 04-hosting/, 05-end-to-end/
- Fix absolute GitHub URLs in package READMEs
- Fix broken link in ollama package README
* fix: convert absolute GitHub URLs to relative paths for link checker
Absolute URLs to python/samples/ on main branch 404 until PR merges.
Converted to relative paths that linkspector can verify locally.
* fix: update link for handoff sample moved to orchestrations/
* fix: update chatkit-integration README path from demos/ to 05-end-to-end/
* fix: update broken links in orchestrations README to match flat directory structure
Eduard van Valkenburg
·
2026-02-12 17:36:36 +00:00
* Centralize tool result parsing in FunctionTool.invoke()
- Add parse_result static method to FunctionTool that converts raw
function return values to strings at invocation time
- Add result_parser parameter to FunctionTool and @tool decorator
for custom parsing
- Remove prepare_function_call_results from all 9 consumer files
and from the public API
- Update MCPTool to parse MCP types directly to strings via
_parse_tool_result_from_mcp and _parse_prompt_result_from_mcp
- Change MCPTool parse_tool_results/parse_prompt_results type from
Literal[True] | Callable | None to Callable | None
- Remove ReturnT type parameter from FunctionTool (now single
generic ArgsT since invoke() always returns str)
- Update all subclass signatures and docstrings
Fixes#1147
* Fix test_mcp_tool_call_tool_with_meta_integration for string results
The test was still accessing result[0].additional_properties but
invoke() now returns a string, not a list of Content objects.
* Fix SIM108 lint: use binary operator for output assignment
* Fix bedrock: use FunctionTool.parse_result instead of str() fallback
str(result) turns None into literal 'None' and dicts into Python reprs
with single quotes, breaking JSON parsing. Use the shared parse_result
which handles None as '' and serializes via json.dumps.
* updated lock
* updates from feedback
Eduard van Valkenburg
·
2026-02-12 13:49:42 +00:00