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

1"""Microsoft Agent Framework integration. 

2 

3Usage: 

4 from astrocyte import Astrocyte 

5 from astrocyte.integrations.microsoft_agent import astrocyte_ms_agent_tools 

6 

7 brain = Astrocyte.from_config("astrocyte.yaml") 

8 tools, handlers = astrocyte_ms_agent_tools(brain, bank_id="user-123") 

9 

10 # Register with Microsoft Agent Framework 

11 agent = Agent(tools=tools) 

12 

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""" 

17 

18from __future__ import annotations 

19 

20from typing import TYPE_CHECKING, Any 

21 

22if TYPE_CHECKING: 

23 from astrocyte._astrocyte import Astrocyte 

24 

25from astrocyte.types import AstrocyteContext 

26 

27 

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. 

37 

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 

42 

43 return astrocyte_tool_definitions( 

44 brain, 

45 bank_id, 

46 context=context, 

47 include_reflect=include_reflect, 

48 include_forget=include_forget, 

49 )