mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: [BREAKING] Renamed AgentRunContext to AgentContext (#3714)
* Renamed AgentRunContext to AgentContext * Update python/packages/core/AGENTS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -55,7 +55,7 @@ agent_framework/
|
||||
- **`AgentMiddleware`** - Intercepts agent `run()` calls
|
||||
- **`ChatMiddleware`** - Intercepts chat client `get_response()` calls
|
||||
- **`FunctionMiddleware`** - Intercepts function/tool invocations
|
||||
- **`AgentRunContext`** / **`ChatContext`** / **`FunctionInvocationContext`** - Context objects passed through middleware
|
||||
- **`AgentContext`** / **`ChatContext`** / **`FunctionInvocationContext`** - Context objects passed through middleware
|
||||
|
||||
### Threads (`_threads.py`)
|
||||
|
||||
@@ -114,10 +114,10 @@ agent = OpenAIChatClient().as_agent(
|
||||
### Middleware Pipeline
|
||||
|
||||
```python
|
||||
from agent_framework import ChatAgent, AgentMiddleware, AgentRunContext
|
||||
from agent_framework import ChatAgent, AgentMiddleware, AgentContext
|
||||
|
||||
class LoggingMiddleware(AgentMiddleware):
|
||||
async def invoke(self, context: AgentRunContext, next) -> AgentResponse:
|
||||
async def process(self, context: AgentContext, next) -> AgentResponse:
|
||||
print(f"Input: {context.messages}")
|
||||
response = await next(context)
|
||||
print(f"Output: {response}")
|
||||
|
||||
Reference in New Issue
Block a user