Coverage for astrocyte/integrations/microsoft_agent.py: 100%
6 statements
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-04 05:24 +0000
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-04 05:24 +0000
1"""Microsoft Agent Framework integration.
3Usage:
4 from astrocyte import Astrocyte
5 from astrocyte.integrations.microsoft_agent import astrocyte_ms_agent_tools
7 brain = Astrocyte.from_config("astrocyte.yaml")
8 tools, handlers = astrocyte_ms_agent_tools(brain, bank_id="user-123")
10 # Register with Microsoft Agent Framework
11 agent = Agent(tools=tools)
13Microsoft Agent Framework uses OpenAI-compatible tool definitions with
14handler functions, similar to the OpenAI Agents SDK pattern. This integration
15provides the same format with Astrocyte-specific tool names.
16"""
18from __future__ import annotations
20from typing import TYPE_CHECKING, Any
22if TYPE_CHECKING:
23 from astrocyte._astrocyte import Astrocyte
25from astrocyte.types import AstrocyteContext
28def astrocyte_ms_agent_tools(
29 brain: Astrocyte,
30 bank_id: str,
31 *,
32 context: AstrocyteContext | None = None,
33 include_reflect: bool = True,
34 include_forget: bool = False,
35) -> tuple[list[dict[str, Any]], dict[str, Any]]:
36 """Create Microsoft Agent Framework-compatible tools.
38 Returns (tools, handlers) — same pattern as openai_agents integration
39 since Microsoft Agent Framework uses OpenAI-compatible tool definitions.
40 """
41 from astrocyte.integrations.openai_agents import astrocyte_tool_definitions
43 return astrocyte_tool_definitions(
44 brain,
45 bank_id,
46 context=context,
47 include_reflect=include_reflect,
48 include_forget=include_forget,
49 )