aury-agent 0.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. aury/__init__.py +2 -0
  2. aury/agents/__init__.py +55 -0
  3. aury/agents/a2a/__init__.py +168 -0
  4. aury/agents/backends/__init__.py +196 -0
  5. aury/agents/backends/artifact/__init__.py +9 -0
  6. aury/agents/backends/artifact/memory.py +130 -0
  7. aury/agents/backends/artifact/types.py +133 -0
  8. aury/agents/backends/code/__init__.py +65 -0
  9. aury/agents/backends/file/__init__.py +11 -0
  10. aury/agents/backends/file/local.py +66 -0
  11. aury/agents/backends/file/types.py +40 -0
  12. aury/agents/backends/invocation/__init__.py +8 -0
  13. aury/agents/backends/invocation/memory.py +81 -0
  14. aury/agents/backends/invocation/types.py +110 -0
  15. aury/agents/backends/memory/__init__.py +8 -0
  16. aury/agents/backends/memory/memory.py +179 -0
  17. aury/agents/backends/memory/types.py +136 -0
  18. aury/agents/backends/message/__init__.py +9 -0
  19. aury/agents/backends/message/memory.py +122 -0
  20. aury/agents/backends/message/types.py +124 -0
  21. aury/agents/backends/sandbox.py +275 -0
  22. aury/agents/backends/session/__init__.py +8 -0
  23. aury/agents/backends/session/memory.py +93 -0
  24. aury/agents/backends/session/types.py +124 -0
  25. aury/agents/backends/shell/__init__.py +11 -0
  26. aury/agents/backends/shell/local.py +110 -0
  27. aury/agents/backends/shell/types.py +55 -0
  28. aury/agents/backends/shell.py +209 -0
  29. aury/agents/backends/snapshot/__init__.py +19 -0
  30. aury/agents/backends/snapshot/git.py +95 -0
  31. aury/agents/backends/snapshot/hybrid.py +125 -0
  32. aury/agents/backends/snapshot/memory.py +86 -0
  33. aury/agents/backends/snapshot/types.py +59 -0
  34. aury/agents/backends/state/__init__.py +29 -0
  35. aury/agents/backends/state/composite.py +49 -0
  36. aury/agents/backends/state/file.py +57 -0
  37. aury/agents/backends/state/memory.py +52 -0
  38. aury/agents/backends/state/sqlite.py +262 -0
  39. aury/agents/backends/state/types.py +178 -0
  40. aury/agents/backends/subagent/__init__.py +165 -0
  41. aury/agents/cli/__init__.py +41 -0
  42. aury/agents/cli/chat.py +239 -0
  43. aury/agents/cli/config.py +236 -0
  44. aury/agents/cli/extensions.py +460 -0
  45. aury/agents/cli/main.py +189 -0
  46. aury/agents/cli/session.py +337 -0
  47. aury/agents/cli/workflow.py +276 -0
  48. aury/agents/context_providers/__init__.py +66 -0
  49. aury/agents/context_providers/artifact.py +299 -0
  50. aury/agents/context_providers/base.py +177 -0
  51. aury/agents/context_providers/memory.py +70 -0
  52. aury/agents/context_providers/message.py +130 -0
  53. aury/agents/context_providers/skill.py +50 -0
  54. aury/agents/context_providers/subagent.py +46 -0
  55. aury/agents/context_providers/tool.py +68 -0
  56. aury/agents/core/__init__.py +83 -0
  57. aury/agents/core/base.py +573 -0
  58. aury/agents/core/context.py +797 -0
  59. aury/agents/core/context_builder.py +303 -0
  60. aury/agents/core/event_bus/__init__.py +15 -0
  61. aury/agents/core/event_bus/bus.py +203 -0
  62. aury/agents/core/factory.py +169 -0
  63. aury/agents/core/isolator.py +97 -0
  64. aury/agents/core/logging.py +95 -0
  65. aury/agents/core/parallel.py +194 -0
  66. aury/agents/core/runner.py +139 -0
  67. aury/agents/core/services/__init__.py +5 -0
  68. aury/agents/core/services/file_session.py +144 -0
  69. aury/agents/core/services/message.py +53 -0
  70. aury/agents/core/services/session.py +53 -0
  71. aury/agents/core/signals.py +109 -0
  72. aury/agents/core/state.py +363 -0
  73. aury/agents/core/types/__init__.py +107 -0
  74. aury/agents/core/types/action.py +176 -0
  75. aury/agents/core/types/artifact.py +135 -0
  76. aury/agents/core/types/block.py +736 -0
  77. aury/agents/core/types/message.py +350 -0
  78. aury/agents/core/types/recall.py +144 -0
  79. aury/agents/core/types/session.py +257 -0
  80. aury/agents/core/types/subagent.py +154 -0
  81. aury/agents/core/types/tool.py +205 -0
  82. aury/agents/eval/__init__.py +331 -0
  83. aury/agents/hitl/__init__.py +57 -0
  84. aury/agents/hitl/ask_user.py +242 -0
  85. aury/agents/hitl/compaction.py +230 -0
  86. aury/agents/hitl/exceptions.py +87 -0
  87. aury/agents/hitl/permission.py +617 -0
  88. aury/agents/hitl/revert.py +216 -0
  89. aury/agents/llm/__init__.py +31 -0
  90. aury/agents/llm/adapter.py +367 -0
  91. aury/agents/llm/openai.py +294 -0
  92. aury/agents/llm/provider.py +476 -0
  93. aury/agents/mcp/__init__.py +153 -0
  94. aury/agents/memory/__init__.py +46 -0
  95. aury/agents/memory/compaction.py +394 -0
  96. aury/agents/memory/manager.py +465 -0
  97. aury/agents/memory/processor.py +177 -0
  98. aury/agents/memory/store.py +187 -0
  99. aury/agents/memory/types.py +137 -0
  100. aury/agents/messages/__init__.py +40 -0
  101. aury/agents/messages/config.py +47 -0
  102. aury/agents/messages/raw_store.py +224 -0
  103. aury/agents/messages/store.py +118 -0
  104. aury/agents/messages/types.py +88 -0
  105. aury/agents/middleware/__init__.py +31 -0
  106. aury/agents/middleware/base.py +341 -0
  107. aury/agents/middleware/chain.py +342 -0
  108. aury/agents/middleware/message.py +129 -0
  109. aury/agents/middleware/message_container.py +126 -0
  110. aury/agents/middleware/raw_message.py +153 -0
  111. aury/agents/middleware/truncation.py +139 -0
  112. aury/agents/middleware/types.py +81 -0
  113. aury/agents/plugin.py +162 -0
  114. aury/agents/react/__init__.py +4 -0
  115. aury/agents/react/agent.py +1923 -0
  116. aury/agents/sandbox/__init__.py +23 -0
  117. aury/agents/sandbox/local.py +239 -0
  118. aury/agents/sandbox/remote.py +200 -0
  119. aury/agents/sandbox/types.py +115 -0
  120. aury/agents/skill/__init__.py +16 -0
  121. aury/agents/skill/loader.py +180 -0
  122. aury/agents/skill/types.py +83 -0
  123. aury/agents/tool/__init__.py +39 -0
  124. aury/agents/tool/builtin/__init__.py +23 -0
  125. aury/agents/tool/builtin/ask_user.py +155 -0
  126. aury/agents/tool/builtin/bash.py +107 -0
  127. aury/agents/tool/builtin/delegate.py +726 -0
  128. aury/agents/tool/builtin/edit.py +121 -0
  129. aury/agents/tool/builtin/plan.py +277 -0
  130. aury/agents/tool/builtin/read.py +91 -0
  131. aury/agents/tool/builtin/thinking.py +111 -0
  132. aury/agents/tool/builtin/yield_result.py +130 -0
  133. aury/agents/tool/decorator.py +252 -0
  134. aury/agents/tool/set.py +204 -0
  135. aury/agents/usage/__init__.py +12 -0
  136. aury/agents/usage/tracker.py +236 -0
  137. aury/agents/workflow/__init__.py +85 -0
  138. aury/agents/workflow/adapter.py +268 -0
  139. aury/agents/workflow/dag.py +116 -0
  140. aury/agents/workflow/dsl.py +575 -0
  141. aury/agents/workflow/executor.py +659 -0
  142. aury/agents/workflow/expression.py +136 -0
  143. aury/agents/workflow/parser.py +182 -0
  144. aury/agents/workflow/state.py +145 -0
  145. aury/agents/workflow/types.py +86 -0
  146. aury_agent-0.0.4.dist-info/METADATA +90 -0
  147. aury_agent-0.0.4.dist-info/RECORD +149 -0
  148. aury_agent-0.0.4.dist-info/WHEEL +4 -0
  149. aury_agent-0.0.4.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,50 @@
1
+ """SkillContextProvider - provides skill definitions."""
2
+ from __future__ import annotations
3
+
4
+ from typing import TYPE_CHECKING
5
+
6
+ from .base import BaseContextProvider, AgentContext
7
+
8
+ if TYPE_CHECKING:
9
+ from ..core.context import InvocationContext
10
+ from ..skill import SkillLoader
11
+
12
+
13
+ class SkillContextProvider(BaseContextProvider):
14
+ """Skill context provider.
15
+
16
+ Provides skill definitions and formatted descriptions.
17
+
18
+ Design: Provider provides skills list AND system_content.
19
+ Agent can use skills list for further processing.
20
+ """
21
+
22
+ _name = "skills"
23
+
24
+ def __init__(self, loader: "SkillLoader"):
25
+ """Initialize SkillContextProvider.
26
+
27
+ Args:
28
+ loader: Skill loader for formatting skills
29
+ """
30
+ self.loader = loader
31
+
32
+ async def fetch(self, ctx: "InvocationContext") -> AgentContext:
33
+ """Fetch skill context.
34
+
35
+ Returns:
36
+ AgentContext with skills list and system_content
37
+ """
38
+ skills = self.loader.skills
39
+ skills_prompt = self.loader.format_for_prompt()
40
+
41
+ if not skills:
42
+ return AgentContext.empty()
43
+
44
+ return AgentContext(
45
+ skills=list(skills),
46
+ system_content=skills_prompt if skills_prompt else None,
47
+ )
48
+
49
+
50
+ __all__ = ["SkillContextProvider"]
@@ -0,0 +1,46 @@
1
+ """SubAgentContextProvider - provides sub-agent configurations."""
2
+ from __future__ import annotations
3
+
4
+ from typing import TYPE_CHECKING
5
+
6
+ from .base import BaseContextProvider, AgentContext
7
+
8
+ if TYPE_CHECKING:
9
+ from ..core.context import InvocationContext
10
+ from ..backends.subagent import SubAgentBackend
11
+
12
+
13
+ class SubAgentContextProvider(BaseContextProvider):
14
+ """Sub-agent context provider.
15
+
16
+ Provides sub-agent configurations. Agent creates DelegateTool from this.
17
+
18
+ Design: Provider only provides DATA (subagents list).
19
+ Agent decides how to use it (create DelegateTool).
20
+ """
21
+
22
+ _name = "subagents"
23
+
24
+ def __init__(self, backend: "SubAgentBackend"):
25
+ """Initialize SubAgentContextProvider.
26
+
27
+ Args:
28
+ backend: Sub-agent backend for listing available agents
29
+ """
30
+ self.backend = backend
31
+
32
+ async def fetch(self, ctx: "InvocationContext") -> AgentContext:
33
+ """Fetch sub-agent configurations.
34
+
35
+ Returns:
36
+ AgentContext with subagents list (NOT DelegateTool)
37
+ """
38
+ agents = await self.backend.list()
39
+ if not agents:
40
+ return AgentContext.empty()
41
+
42
+ # Return subagents list - Agent will create DelegateTool
43
+ return AgentContext(subagents=list(agents))
44
+
45
+
46
+ __all__ = ["SubAgentContextProvider"]
@@ -0,0 +1,68 @@
1
+ """ToolContextProvider - example of dynamic tool discovery.
2
+
3
+ NOTE: This provider is commented out as an EXAMPLE.
4
+ In most cases, tools should be passed directly to ReactAgent.create(tools=[...]).
5
+
6
+ This provider is useful for:
7
+ - Dynamic tool discovery (MCP, database, etc.)
8
+ - Permission-based tool filtering
9
+ - Runtime tool injection
10
+
11
+ Usage:
12
+ class MCPToolContextProvider(BaseContextProvider):
13
+ async def fetch(self, ctx):
14
+ # Discover tools from MCP server
15
+ tools = await self.mcp_client.list_tools()
16
+ return AgentContext(tools=tools)
17
+ """
18
+ from __future__ import annotations
19
+
20
+ from typing import TYPE_CHECKING, Any
21
+
22
+ from .base import BaseContextProvider, AgentContext
23
+
24
+ if TYPE_CHECKING:
25
+ from ..core.context import InvocationContext
26
+ from ..core.types.tool import BaseTool
27
+
28
+
29
+ # =============================================================================
30
+ # ToolContextProvider - Example (commented out)
31
+ # =============================================================================
32
+ #
33
+ # class ToolContextProvider(BaseContextProvider):
34
+ # """Tool context provider - for dynamic tool discovery.
35
+ #
36
+ # NOTE: Static tools should be passed directly to Agent.
37
+ # This provider is for DYNAMIC tool discovery only.
38
+ #
39
+ # Example use cases:
40
+ # 1. MCP server - discover tools at runtime
41
+ # 2. Permission-based - filter tools by user permissions
42
+ # 3. Database - load tools from database
43
+ #
44
+ # Usage:
45
+ # class MCPToolContextProvider(ToolContextProvider):
46
+ # async def discover(self, ctx):
47
+ # return await self.mcp_client.list_tools()
48
+ # """
49
+ #
50
+ # _name = "tools"
51
+ #
52
+ # async def fetch(self, ctx: "InvocationContext") -> AgentContext:
53
+ # """Fetch tools dynamically."""
54
+ # discovered = await self.discover(ctx)
55
+ # return AgentContext(tools=discovered)
56
+ #
57
+ # async def discover(self, ctx: "InvocationContext") -> list["BaseTool"]:
58
+ # """Override this for custom discovery logic.
59
+ #
60
+ # Examples:
61
+ # - Fetch from MCP server
62
+ # - Filter by user permissions
63
+ # - Load from database
64
+ # """
65
+ # return []
66
+
67
+
68
+ __all__: list[str] = [] # No exports - this is an example file
@@ -0,0 +1,83 @@
1
+ """Core module - shared infrastructure for agents."""
2
+ from .base import AgentConfig, BaseAgent, ToolInjectionMode
3
+ from .context import InvocationContext, MaxDepthExceededError
4
+ from .factory import AgentFactory
5
+ from .isolator import StateIsolator, ChainMapIsolator
6
+ from .logging import logger
7
+ from .runner import Runner
8
+ from .event_bus import EventBus, Events
9
+ from .signals import SuspendSignal, HITLSuspend, PauseSuspend
10
+ from .parallel import (
11
+ merge_agent_runs,
12
+ run_agents_parallel,
13
+ ParallelSubAgentContext,
14
+ )
15
+ from .types import (
16
+ Session,
17
+ Invocation,
18
+ InvocationState,
19
+ InvocationMode,
20
+ ControlFrame,
21
+ generate_id,
22
+ PromptInput,
23
+ Message,
24
+ MessageRole,
25
+ BlockEvent,
26
+ BlockKind,
27
+ BlockOp,
28
+ BlockHandle,
29
+ ToolContext,
30
+ ToolResult,
31
+ ToolInfo,
32
+ BaseTool,
33
+ )
34
+
35
+ __all__ = [
36
+ # Base
37
+ "AgentConfig",
38
+ "BaseAgent",
39
+ "ToolInjectionMode",
40
+ # Context
41
+ "InvocationContext",
42
+ "MaxDepthExceededError",
43
+ # Factory
44
+ "AgentFactory",
45
+ # Isolator
46
+ "StateIsolator",
47
+ "ChainMapIsolator",
48
+ # Logging
49
+ "logger",
50
+ # Runner
51
+ "Runner",
52
+ "EventBus",
53
+ "Events",
54
+ # Signals
55
+ "SuspendSignal",
56
+ "HITLSuspend",
57
+ "PauseSuspend",
58
+ # Parallel
59
+ "merge_agent_runs",
60
+ "run_agents_parallel",
61
+ "ParallelSubAgentContext",
62
+ # Types - Session
63
+ "Session",
64
+ "Invocation",
65
+ "InvocationState",
66
+ "InvocationMode",
67
+ "ControlFrame",
68
+ "generate_id",
69
+ # Types - Message
70
+ "PromptInput",
71
+ "Message",
72
+ "MessageRole",
73
+ # Types - Block
74
+ "BlockEvent",
75
+ "BlockKind",
76
+ "BlockOp",
77
+ "BlockHandle",
78
+ # Types - Tool
79
+ "ToolContext",
80
+ "ToolResult",
81
+ "ToolInfo",
82
+ "BaseTool",
83
+ ]