Skip to content

Commit f30a2b1

Browse files
moved observability because it is not agent specific and reordered agent pages
1 parent fbbe6fa commit f30a2b1

9 files changed

Lines changed: 48 additions & 53 deletions

File tree

agent-framework/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ items:
2020
href: user-guide/hosting/TOC.yml
2121
- name: DevUI
2222
href: user-guide/devui/TOC.yml
23+
- name: Observability
24+
href: user-guide/observability.md
2325
- name: Integrations
2426
items:
2527
- name: AG-UI

agent-framework/user-guide/agents/TOC.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
href: agent-types/TOC.yml
33
- name: Running Agents
44
href: running-agents.md
5-
- name: Agent Tools
6-
href: agent-tools.md
75
- name: Multi-Turn Conversations and Threading
86
href: multi-turn-conversation.md
9-
- name: Agent Middleware
10-
href: agent-middleware.md
11-
- name: Agent Retrieval Augmented Generation (RAG)
12-
href: agent-rag.md
137
- name: Agent Chat History and Memory
148
href: agent-memory.md
15-
- name: Agent Observability
16-
href: agent-observability.md
9+
- name: Agent Tools
10+
href: agent-tools.md
11+
- name: Agent Retrieval Augmented Generation (RAG)
12+
href: agent-rag.md
13+
- name: Agent Middleware
14+
href: agent-middleware.md
1715
- name: Agent Background Responses
1816
href: agent-background-responses.md

agent-framework/user-guide/agents/agent-memory.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,21 +244,21 @@ class DatabaseMessageStore(ChatMessageStoreProtocol):
244244
def __init__(self, connection_string: str):
245245
self.connection_string = connection_string
246246
self._messages: list[ChatMessage] = []
247-
247+
248248
async def add_messages(self, messages: Sequence[ChatMessage]) -> None:
249249
"""Add messages to database."""
250250
# Implement database insertion logic
251251
self._messages.extend(messages)
252-
252+
253253
async def list_messages(self) -> list[ChatMessage]:
254254
"""Retrieve messages from database."""
255255
# Implement database query logic
256256
return self._messages
257-
257+
258258
async def serialize(self, **kwargs: Any) -> Any:
259259
"""Serialize store state for persistence."""
260260
return {"connection_string": self.connection_string}
261-
261+
262262
async def update_from_state(self, serialized_store_state: Any, **kwargs: Any) -> None:
263263
"""Update store from serialized state."""
264264
if serialized_store_state:
@@ -280,15 +280,15 @@ from typing import Any
280280
class UserPreferencesMemory(ContextProvider):
281281
def __init__(self):
282282
self.preferences = {}
283-
283+
284284
async def invoking(self, messages: ChatMessage | MutableSequence[ChatMessage], **kwargs: Any) -> Context:
285285
"""Provide user preferences before each invocation."""
286286
if self.preferences:
287287
preferences_text = ", ".join([f"{k}: {v}" for k, v in self.preferences.items()])
288288
instructions = f"User preferences: {preferences_text}"
289289
return Context(instructions=instructions)
290290
return Context()
291-
291+
292292
async def invoked(
293293
self,
294294
request_messages: ChatMessage | Sequence[ChatMessage],
@@ -357,4 +357,4 @@ await agent.run("What's my name?", thread=restored_thread)
357357
## Next steps
358358

359359
> [!div class="nextstepaction"]
360-
> [Agent Observability](./agent-observability.md)
360+
> [Agent Tools](./agent-tools.md)

agent-framework/user-guide/agents/agent-middleware.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ async def logging_agent_middleware(
194194
"""Agent middleware that logs execution timing."""
195195
# Pre-processing: Log before agent execution
196196
print("[Agent] Starting execution")
197-
197+
198198
# Continue to next middleware or agent execution
199199
await next(context)
200-
200+
201201
# Post-processing: Log after agent execution
202202
print("[Agent] Execution completed")
203203
```
@@ -225,10 +225,10 @@ async def logging_function_middleware(
225225
"""Function middleware that logs function execution."""
226226
# Pre-processing: Log before function execution
227227
print(f"[Function] Calling {context.function.name}")
228-
228+
229229
# Continue to next middleware or function execution
230230
await next(context)
231-
231+
232232
# Post-processing: Log after function execution
233233
print(f"[Function] {context.function.name} completed")
234234
```
@@ -258,10 +258,10 @@ async def logging_chat_middleware(
258258
"""Chat middleware that logs AI interactions."""
259259
# Pre-processing: Log before AI call
260260
print(f"[Chat] Sending {len(context.messages)} messages to AI")
261-
261+
262262
# Continue to next middleware or AI service
263263
await next(context)
264-
264+
265265
# Post-processing: Log after AI response
266266
print("[Chat] AI response received")
267267
```
@@ -312,18 +312,18 @@ from agent_framework import AgentMiddleware, AgentRunContext
312312

313313
class LoggingAgentMiddleware(AgentMiddleware):
314314
"""Agent middleware that logs execution."""
315-
315+
316316
async def process(
317317
self,
318318
context: AgentRunContext,
319319
next: Callable[[AgentRunContext], Awaitable[None]],
320320
) -> None:
321321
# Pre-processing: Log before agent execution
322322
print("[Agent Class] Starting execution")
323-
323+
324324
# Continue to next middleware or agent execution
325325
await next(context)
326-
326+
327327
# Post-processing: Log after agent execution
328328
print("[Agent Class] Execution completed")
329329
```
@@ -337,18 +337,18 @@ from agent_framework import FunctionMiddleware, FunctionInvocationContext
337337

338338
class LoggingFunctionMiddleware(FunctionMiddleware):
339339
"""Function middleware that logs function execution."""
340-
340+
341341
async def process(
342342
self,
343343
context: FunctionInvocationContext,
344344
next: Callable[[FunctionInvocationContext], Awaitable[None]],
345345
) -> None:
346346
# Pre-processing: Log before function execution
347347
print(f"[Function Class] Calling {context.function.name}")
348-
348+
349349
# Continue to next middleware or function execution
350350
await next(context)
351-
351+
352352
# Post-processing: Log after function execution
353353
print(f"[Function Class] {context.function.name} completed")
354354
```
@@ -362,18 +362,18 @@ from agent_framework import ChatMiddleware, ChatContext
362362

363363
class LoggingChatMiddleware(ChatMiddleware):
364364
"""Chat middleware that logs AI interactions."""
365-
365+
366366
async def process(
367367
self,
368368
context: ChatContext,
369369
next: Callable[[ChatContext], Awaitable[None]],
370370
) -> None:
371371
# Pre-processing: Log before AI call
372372
print(f"[Chat Class] Sending {len(context.messages)} messages to AI")
373-
373+
374374
# Continue to next middleware or AI service
375375
await next(context)
376-
376+
377377
# Post-processing: Log after AI response
378378
print("[Chat Class] AI response received")
379379
```
@@ -398,18 +398,18 @@ async with AzureAIAgentClient(async_credential=credential).create_agent(
398398
TimingFunctionMiddleware(), # Applies to all runs
399399
],
400400
) as agent:
401-
401+
402402
# This run uses agent-level middleware only
403403
result1 = await agent.run("What's the weather in Seattle?")
404-
404+
405405
# This run uses agent-level + run-level middleware
406406
result2 = await agent.run(
407407
"What's the weather in Portland?",
408408
middleware=[ # Run-level middleware (this run only)
409409
logging_chat_middleware,
410410
]
411411
)
412-
412+
413413
# This run uses agent-level middleware only (no run-level)
414414
result3 = await agent.run("What's the weather in Vancouver?")
415415
```
@@ -436,7 +436,7 @@ async def blocking_middleware(
436436
print("Request blocked by middleware")
437437
context.terminate = True
438438
return
439-
439+
440440
# If no issues, continue normally
441441
await next(context)
442442
```
@@ -458,14 +458,14 @@ You can use `context.is_streaming` to differentiate between these scenarios and
458458

459459
```python
460460
async def weather_override_middleware(
461-
context: AgentRunContext,
461+
context: AgentRunContext,
462462
next: Callable[[AgentRunContext], Awaitable[None]]
463463
) -> None:
464464
"""Middleware that overrides weather results for both streaming and non-streaming."""
465-
465+
466466
# Execute the original agent logic
467467
await next(context)
468-
468+
469469
# Override results if present
470470
if context.result is not None:
471471
custom_message_parts = [
@@ -474,13 +474,13 @@ async def weather_override_middleware(
474474
"22°C with gentle breezes. ",
475475
"Great day for outdoor activities!"
476476
]
477-
477+
478478
if context.is_streaming:
479479
# Streaming override
480480
async def override_stream() -> AsyncIterable[AgentRunResponseUpdate]:
481481
for chunk in custom_message_parts:
482482
yield AgentRunResponseUpdate(contents=[TextContent(text=chunk)])
483-
483+
484484
context.result = override_stream()
485485
else:
486486
# Non-streaming override
@@ -497,4 +497,4 @@ This middleware approach allows you to implement sophisticated response transfor
497497
## Next steps
498498

499499
> [!div class="nextstepaction"]
500-
> [Agent Retrieval Augmented Generation (RAG)](./agent-rag.md)
500+
> [Agent Background Responses](./agent-background-responses.md)

agent-framework/user-guide/agents/agent-rag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,4 +297,4 @@ Each connector provides the same `create_search_function` method that can be bri
297297
## Next steps
298298

299299
> [!div class="nextstepaction"]
300-
> [Agent Chat History and Memory](./agent-memory.md)
300+
> [Agent Middleware](./agent-middleware.md)

agent-framework/user-guide/agents/agent-tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ result1 = await agent.run(
162162

163163
# Use different tools for different runs
164164
result2 = await agent.run(
165-
"What's the current time?",
165+
"What's the current time?",
166166
tools=[get_time] # Different tool for this query
167167
)
168168

@@ -292,4 +292,4 @@ result = await agent.run(
292292
## Next steps
293293

294294
> [!div class="nextstepaction"]
295-
> [Multi-turn Conversation](./multi-turn-conversation.md)
295+
> [Agent Retrieval Augmented Generation](./agent-rag.md)

agent-framework/user-guide/agents/multi-turn-conversation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,4 @@ async def multi_turn_example():
226226
## Next steps
227227

228228
> [!div class="nextstepaction"]
229-
> [Agent Middleware](./agent-middleware.md)
229+
> [Agent Memory](./agent-memory.md)

agent-framework/user-guide/agents/running-agents.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Python agents support passing keyword arguments to customize each run. The speci
8080
Common options for `ChatAgent` include:
8181

8282
- `max_tokens`: Maximum number of tokens to generate
83-
- `temperature`: Controls randomness in response generation
83+
- `temperature`: Controls randomness in response generation
8484
- `model`: Override the model for this specific run
8585
- `tools`: Add additional tools for this run only
8686
- `response_format`: Specify the response format (e.g., structured output)
@@ -171,7 +171,7 @@ of the result contained in the update, and drill into the detail via the `conten
171171
async for update in agent.run_stream("What is the weather like in Amsterdam?"):
172172
print(f"Update text: {update.text}")
173173
print(f"Content count: {len(update.contents)}")
174-
174+
175175
# Access individual content items
176176
for content in update.contents:
177177
if hasattr(content, 'text'):
@@ -256,4 +256,4 @@ for message in response.messages:
256256
## Next steps
257257

258258
> [!div class="nextstepaction"]
259-
> [Agent Tools](./agent-tools.md)
259+
> [Multi-Turn Conversations and Threading](./multi-turn-conversation.md)

agent-framework/user-guide/agents/agent-observability.md renamed to agent-framework/user-guide/observability.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Agent Observability
2+
title: Observability
33
description: Learn how to use observability with Agent Framework
44
zone_pivot_groups: programming-languages
55
author: eavanvalkenburg
@@ -470,8 +470,3 @@ This trace shows:
470470
We have a number of samples in our repository that demonstrate these capabilities, see the [observability samples folder](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/observability) on Github. That includes samples for using zero-code telemetry as well.
471471

472472
::: zone-end
473-
474-
## Next steps
475-
476-
> [!div class="nextstepaction"]
477-
> [Background Responses](./agent-background-responses.md)

0 commit comments

Comments
 (0)