locus-sdk 0.2.0b1__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.
- locus/__init__.py +241 -0
- locus/a2a/__init__.py +99 -0
- locus/a2a/protocol.py +1038 -0
- locus/a2a/spec.py +402 -0
- locus/agent/__init__.py +37 -0
- locus/agent/agent.py +535 -0
- locus/agent/composition.py +352 -0
- locus/agent/config.py +578 -0
- locus/agent/hook_orchestrator.py +151 -0
- locus/agent/initializer.py +250 -0
- locus/agent/result.py +339 -0
- locus/agent/runtime_loop.py +1668 -0
- locus/core/__init__.py +178 -0
- locus/core/command.py +260 -0
- locus/core/config.py +176 -0
- locus/core/errors.py +207 -0
- locus/core/events.py +259 -0
- locus/core/interrupt.py +404 -0
- locus/core/messages.py +151 -0
- locus/core/protocols.py +348 -0
- locus/core/reducers.py +466 -0
- locus/core/send.py +325 -0
- locus/core/state.py +379 -0
- locus/core/structured.py +432 -0
- locus/core/termination.py +237 -0
- locus/core/warnings.py +41 -0
- locus/deepagent/__init__.py +137 -0
- locus/deepagent/backends/__init__.py +37 -0
- locus/deepagent/backends/filesystem.py +243 -0
- locus/deepagent/backends/protocol.py +123 -0
- locus/deepagent/backends/state.py +225 -0
- locus/deepagent/factory.py +219 -0
- locus/deepagent/memory.py +48 -0
- locus/deepagent/protocol.py +127 -0
- locus/deepagent/subagent.py +153 -0
- locus/deepagent/todos.py +122 -0
- locus/deepagent/tools/__init__.py +16 -0
- locus/deepagent/tools/filesystem.py +160 -0
- locus/deepagent/workflow.py +642 -0
- locus/evaluation/__init__.py +26 -0
- locus/evaluation/framework.py +226 -0
- locus/hooks/__init__.py +65 -0
- locus/hooks/builtin/__init__.py +64 -0
- locus/hooks/builtin/guardrails.py +765 -0
- locus/hooks/builtin/logging.py +279 -0
- locus/hooks/builtin/retry.py +130 -0
- locus/hooks/builtin/steering.py +248 -0
- locus/hooks/builtin/telemetry.py +393 -0
- locus/hooks/events.py +86 -0
- locus/hooks/plugin.py +137 -0
- locus/hooks/provider.py +383 -0
- locus/hooks/registry.py +387 -0
- locus/integrations/__init__.py +18 -0
- locus/integrations/fastmcp.py +723 -0
- locus/integrations/osv.py +194 -0
- locus/loop/__init__.py +54 -0
- locus/loop/nodes.py +363 -0
- locus/loop/react.py +279 -0
- locus/loop/router.py +241 -0
- locus/loop/runner.py +307 -0
- locus/memory/__init__.py +115 -0
- locus/memory/backends/__init__.py +81 -0
- locus/memory/backends/adapters.py +649 -0
- locus/memory/backends/file.py +288 -0
- locus/memory/backends/http.py +301 -0
- locus/memory/backends/memory.py +247 -0
- locus/memory/backends/oci_bucket.py +607 -0
- locus/memory/backends/opensearch.py +301 -0
- locus/memory/backends/oracle.py +565 -0
- locus/memory/backends/postgresql.py +454 -0
- locus/memory/backends/redis.py +127 -0
- locus/memory/backends/sqlite.py +206 -0
- locus/memory/checkpointer.py +335 -0
- locus/memory/compactor.py +329 -0
- locus/memory/conversation.py +325 -0
- locus/memory/delta.py +546 -0
- locus/memory/manager.py +584 -0
- locus/memory/registry.py +221 -0
- locus/memory/store.py +935 -0
- locus/models/__init__.py +99 -0
- locus/models/auxiliary.py +56 -0
- locus/models/base.py +114 -0
- locus/models/caching.py +85 -0
- locus/models/credentials.py +212 -0
- locus/models/failover.py +787 -0
- locus/models/metadata.py +357 -0
- locus/models/native/__init__.py +22 -0
- locus/models/native/anthropic.py +388 -0
- locus/models/native/ollama.py +222 -0
- locus/models/native/openai.py +487 -0
- locus/models/pooled.py +212 -0
- locus/models/providers/__init__.py +18 -0
- locus/models/providers/oci/__init__.py +397 -0
- locus/models/providers/oci/_signing.py +137 -0
- locus/models/providers/oci/base.py +130 -0
- locus/models/providers/oci/client.py +271 -0
- locus/models/providers/oci/models/__init__.py +14 -0
- locus/models/providers/oci/models/cohere.py +263 -0
- locus/models/providers/oci/models/generic.py +315 -0
- locus/models/providers/oci/openai_compat.py +376 -0
- locus/models/rate_limits.py +237 -0
- locus/models/registry.py +154 -0
- locus/multiagent/__init__.py +134 -0
- locus/multiagent/functional.py +234 -0
- locus/multiagent/graph.py +1551 -0
- locus/multiagent/handoff.py +618 -0
- locus/multiagent/orchestrator.py +467 -0
- locus/multiagent/specialist.py +495 -0
- locus/multiagent/swarm.py +686 -0
- locus/multiagent/visualize.py +139 -0
- locus/observability/__init__.py +67 -0
- locus/observability/agent_bridge.py +171 -0
- locus/observability/bus_hook.py +175 -0
- locus/observability/context.py +137 -0
- locus/observability/emit.py +216 -0
- locus/observability/event_bus.py +369 -0
- locus/observability/router_events.py +188 -0
- locus/playbooks/__init__.py +45 -0
- locus/playbooks/enforcer.py +403 -0
- locus/playbooks/hook.py +161 -0
- locus/playbooks/loader.py +271 -0
- locus/playbooks/models.py +202 -0
- locus/providers/__init__.py +63 -0
- locus/providers/image.py +113 -0
- locus/providers/speech.py +171 -0
- locus/providers/tools.py +217 -0
- locus/providers/types.py +42 -0
- locus/providers/web_fetch.py +194 -0
- locus/providers/web_search.py +129 -0
- locus/py.typed +0 -0
- locus/rag/__init__.py +163 -0
- locus/rag/embeddings/__init__.py +47 -0
- locus/rag/embeddings/base.py +219 -0
- locus/rag/embeddings/oci.py +397 -0
- locus/rag/embeddings/openai.py +207 -0
- locus/rag/multimodal.py +586 -0
- locus/rag/retriever.py +562 -0
- locus/rag/stores/__init__.py +84 -0
- locus/rag/stores/base.py +266 -0
- locus/rag/stores/chroma.py +428 -0
- locus/rag/stores/memory.py +155 -0
- locus/rag/stores/opensearch.py +396 -0
- locus/rag/stores/oracle.py +533 -0
- locus/rag/stores/pgvector.py +608 -0
- locus/rag/stores/pinecone.py +405 -0
- locus/rag/stores/qdrant.py +459 -0
- locus/rag/tools.py +265 -0
- locus/reasoning/__init__.py +79 -0
- locus/reasoning/causal.py +727 -0
- locus/reasoning/grounding.py +677 -0
- locus/reasoning/gsar.py +392 -0
- locus/reasoning/gsar_evaluator.py +262 -0
- locus/reasoning/gsar_judge.py +336 -0
- locus/reasoning/reflexion.py +515 -0
- locus/router/__init__.py +111 -0
- locus/router/capability.py +133 -0
- locus/router/compiler.py +181 -0
- locus/router/goal_frame.py +145 -0
- locus/router/policy.py +103 -0
- locus/router/protocol.py +646 -0
- locus/router/runnable.py +234 -0
- locus/router/runtime.py +129 -0
- locus/router/skill_index.py +80 -0
- locus/server/__init__.py +26 -0
- locus/server/app.py +436 -0
- locus/skills/__init__.py +37 -0
- locus/skills/models.py +255 -0
- locus/skills/plugin.py +207 -0
- locus/streaming/__init__.py +49 -0
- locus/streaming/console.py +373 -0
- locus/streaming/handler.py +284 -0
- locus/streaming/sse.py +443 -0
- locus/streaming/structured.py +144 -0
- locus/tools/__init__.py +25 -0
- locus/tools/builtins.py +57 -0
- locus/tools/context.py +69 -0
- locus/tools/decorator.py +189 -0
- locus/tools/executor.py +419 -0
- locus/tools/path_safety.py +99 -0
- locus/tools/registry.py +87 -0
- locus/tools/result_storage.py +183 -0
- locus/tools/schema.py +206 -0
- locus/tools/url_safety.py +193 -0
- locus/tools/watcher.py +304 -0
- locus_sdk-0.2.0b1.dist-info/METADATA +443 -0
- locus_sdk-0.2.0b1.dist-info/RECORD +189 -0
- locus_sdk-0.2.0b1.dist-info/WHEEL +4 -0
- locus_sdk-0.2.0b1.dist-info/licenses/LICENSE +28 -0
- locus_sdk-0.2.0b1.dist-info/licenses/LICENSE.txt +28 -0
locus/__init__.py
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Copyright (c) 2025, 2026 Oracle and/or its affiliates.
|
|
2
|
+
# Licensed under the Universal Permissive License v1.0 as shown at
|
|
3
|
+
# https://oss.oracle.com/licenses/upl/
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Locus - A zero-LangChain agentic SDK.
|
|
7
|
+
|
|
8
|
+
Built-in Reflexion, Grounding Evaluation, and production-grade orchestration.
|
|
9
|
+
100% Pydantic. No magic.
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
from locus import Agent, tool
|
|
13
|
+
|
|
14
|
+
@tool
|
|
15
|
+
def search(query: str) -> str:
|
|
16
|
+
'''Search the knowledge base.'''
|
|
17
|
+
return "results..."
|
|
18
|
+
|
|
19
|
+
agent = Agent(
|
|
20
|
+
model="openai:gpt-4o", # or oci:cohere.command-r-plus
|
|
21
|
+
tools=[search],
|
|
22
|
+
system_prompt="You are a helpful assistant.",
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
async for event in agent.run("Find information about X"):
|
|
26
|
+
print(event)
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
from locus.core.config import LocusSettings
|
|
30
|
+
from locus.core.errors import LocusError
|
|
31
|
+
from locus.core.events import (
|
|
32
|
+
GroundingEvent,
|
|
33
|
+
LocusEvent,
|
|
34
|
+
ReflectEvent,
|
|
35
|
+
TerminateEvent,
|
|
36
|
+
ThinkEvent,
|
|
37
|
+
ToolCompleteEvent,
|
|
38
|
+
ToolStartEvent,
|
|
39
|
+
)
|
|
40
|
+
from locus.core.messages import Message, Role, ToolCall
|
|
41
|
+
from locus.core.state import AgentState
|
|
42
|
+
from locus.tools.context import ToolContext
|
|
43
|
+
from locus.tools.decorator import tool
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Lazy import mapping for optional dependencies
|
|
47
|
+
_LAZY_IMPORTS = {
|
|
48
|
+
"Agent": ("locus.agent.agent", "Agent"),
|
|
49
|
+
"AgentConfig": ("locus.agent.config", "AgentConfig"),
|
|
50
|
+
"AgentResult": ("locus.agent.result", "AgentResult"),
|
|
51
|
+
# Composition primitives — graph-free orchestration shapes.
|
|
52
|
+
"SequentialPipeline": ("locus.agent.composition", "SequentialPipeline"),
|
|
53
|
+
"ParallelPipeline": ("locus.agent.composition", "ParallelPipeline"),
|
|
54
|
+
"LoopAgent": ("locus.agent.composition", "LoopAgent"),
|
|
55
|
+
# Multi-agent primitives — graph + handoff + orchestrator/specialist.
|
|
56
|
+
"StateGraph": ("locus.multiagent.graph", "StateGraph"),
|
|
57
|
+
"GraphConfig": ("locus.multiagent.graph", "GraphConfig"),
|
|
58
|
+
"START": ("locus.multiagent.graph", "START"),
|
|
59
|
+
"END": ("locus.multiagent.graph", "END"),
|
|
60
|
+
"Send": ("locus.core.send", "Send"),
|
|
61
|
+
"Handoff": ("locus.multiagent.handoff", "Handoff"),
|
|
62
|
+
"HandoffContext": ("locus.multiagent.handoff", "HandoffContext"),
|
|
63
|
+
"HandoffReason": ("locus.multiagent.handoff", "HandoffReason"),
|
|
64
|
+
"create_handoff_agent": ("locus.multiagent.handoff", "create_handoff_agent"),
|
|
65
|
+
"create_handoff_manager": ("locus.multiagent.handoff", "create_handoff_manager"),
|
|
66
|
+
"Orchestrator": ("locus.multiagent.orchestrator", "Orchestrator"),
|
|
67
|
+
"RoutingDecision": ("locus.multiagent.orchestrator", "RoutingDecision"),
|
|
68
|
+
"create_orchestrator": ("locus.multiagent.orchestrator", "create_orchestrator"),
|
|
69
|
+
"Specialist": ("locus.multiagent.specialist", "Specialist"),
|
|
70
|
+
# Public name "Reflexion" maps to the actual class "Reflector". The
|
|
71
|
+
# mismatch was an import error on locus 0.1.0 — keep the alias so existing
|
|
72
|
+
# docs / code that does ``from locus import Reflexion`` keeps working.
|
|
73
|
+
"Reflexion": ("locus.reasoning.reflexion", "Reflector"),
|
|
74
|
+
"Reflector": ("locus.reasoning.reflexion", "Reflector"),
|
|
75
|
+
"GroundingEvaluator": ("locus.reasoning.grounding", "GroundingEvaluator"),
|
|
76
|
+
"CausalChain": ("locus.reasoning.causal", "CausalChain"),
|
|
77
|
+
"HookProvider": ("locus.hooks.provider", "HookProvider"),
|
|
78
|
+
"HookRegistry": ("locus.hooks.registry", "HookRegistry"),
|
|
79
|
+
# RAG
|
|
80
|
+
"RAGRetriever": ("locus.rag.retriever", "RAGRetriever"),
|
|
81
|
+
"OCIEmbeddings": ("locus.rag.embeddings.oci", "OCIEmbeddings"),
|
|
82
|
+
"OracleVectorStore": ("locus.rag.stores.oracle", "OracleVectorStore"),
|
|
83
|
+
# PRISM router — bounded-graph generation atop locus primitives.
|
|
84
|
+
"Router": ("locus.router.runtime", "Router"),
|
|
85
|
+
"GoalFrame": ("locus.router.goal_frame", "GoalFrame"),
|
|
86
|
+
"TaskType": ("locus.router.goal_frame", "TaskType"),
|
|
87
|
+
"Risk": ("locus.router.goal_frame", "Risk"),
|
|
88
|
+
"Complexity": ("locus.router.goal_frame", "Complexity"),
|
|
89
|
+
"Capability": ("locus.router.capability", "Capability"),
|
|
90
|
+
"CapabilityIndex": ("locus.router.capability", "CapabilityIndex"),
|
|
91
|
+
"Protocol": ("locus.router.protocol", "Protocol"),
|
|
92
|
+
"ProtocolRegistry": ("locus.router.protocol", "ProtocolRegistry"),
|
|
93
|
+
"PolicyGate": ("locus.router.policy", "PolicyGate"),
|
|
94
|
+
"PolicyVerdict": ("locus.router.policy", "PolicyVerdict"),
|
|
95
|
+
"CognitiveCompiler": ("locus.router.compiler", "CognitiveCompiler"),
|
|
96
|
+
"RunnableResult": ("locus.router.runnable", "RunnableResult"),
|
|
97
|
+
"SkillIndex": ("locus.router.skill_index", "SkillIndex"),
|
|
98
|
+
"builtin_protocols": ("locus.router.protocol", "builtin_protocols"),
|
|
99
|
+
# Deep research — research-shaped Agent factory + provider protocol.
|
|
100
|
+
# Submodule is ``locus.deepagent`` (Pythonic path-name convention).
|
|
101
|
+
# Factory is ``create_deepagent`` (matches ``create_orchestrator``,
|
|
102
|
+
# ``create_handoff_agent`` — the existing locus naming for "build me
|
|
103
|
+
# a configured X").
|
|
104
|
+
"create_deepagent": ("locus.deepagent", "create_deepagent"),
|
|
105
|
+
"create_research_workflow": ("locus.deepagent.workflow", "create_research_workflow"),
|
|
106
|
+
"make_execute_node": ("locus.deepagent.workflow", "make_execute_node"),
|
|
107
|
+
"make_causal_inference_node": ("locus.deepagent.workflow", "make_causal_inference_node"),
|
|
108
|
+
"make_summarize_node": ("locus.deepagent.workflow", "make_summarize_node"),
|
|
109
|
+
"make_grounding_eval_node": ("locus.deepagent.workflow", "make_grounding_eval_node"),
|
|
110
|
+
"make_regenerate_summary_node": ("locus.deepagent.workflow", "make_regenerate_summary_node"),
|
|
111
|
+
"make_replan_node": ("locus.deepagent.workflow", "make_replan_node"),
|
|
112
|
+
"route_after_grounding": ("locus.deepagent.workflow", "route_after_grounding"),
|
|
113
|
+
# Research workflow state keys
|
|
114
|
+
"KEY_PROMPT": ("locus.deepagent.workflow", "KEY_PROMPT"),
|
|
115
|
+
"KEY_EXECUTE_PROMPT": ("locus.deepagent.workflow", "KEY_EXECUTE_PROMPT"),
|
|
116
|
+
"KEY_EVIDENCE": ("locus.deepagent.workflow", "KEY_EVIDENCE"),
|
|
117
|
+
"KEY_GROUNDING_FACTS": ("locus.deepagent.workflow", "KEY_GROUNDING_FACTS"),
|
|
118
|
+
"KEY_CAUSAL_CHAIN": ("locus.deepagent.workflow", "KEY_CAUSAL_CHAIN"),
|
|
119
|
+
"KEY_CAUSAL_HYPOTHESIS": ("locus.deepagent.workflow", "KEY_CAUSAL_HYPOTHESIS"),
|
|
120
|
+
"KEY_CAUSAL_CONFIDENCE": ("locus.deepagent.workflow", "KEY_CAUSAL_CONFIDENCE"),
|
|
121
|
+
"KEY_SUMMARY": ("locus.deepagent.workflow", "KEY_SUMMARY"),
|
|
122
|
+
"KEY_STRUCTURED_OUTPUT": ("locus.deepagent.workflow", "KEY_STRUCTURED_OUTPUT"),
|
|
123
|
+
"KEY_GROUNDING_SCORE": ("locus.deepagent.workflow", "KEY_GROUNDING_SCORE"),
|
|
124
|
+
"KEY_UNGROUNDED_CLAIMS": ("locus.deepagent.workflow", "KEY_UNGROUNDED_CLAIMS"),
|
|
125
|
+
"KEY_REPLAN_COUNT": ("locus.deepagent.workflow", "KEY_REPLAN_COUNT"),
|
|
126
|
+
"KEY_REGENERATION_COUNT": ("locus.deepagent.workflow", "KEY_REGENERATION_COUNT"),
|
|
127
|
+
"KEY_STOP_REASON": ("locus.deepagent.workflow", "KEY_STOP_REASON"),
|
|
128
|
+
"KnowledgeProvider": ("locus.deepagent", "KnowledgeProvider"),
|
|
129
|
+
"KnowledgeRow": ("locus.deepagent", "KnowledgeRow"),
|
|
130
|
+
"ItemRef": ("locus.deepagent", "ItemRef"),
|
|
131
|
+
"Grounding": ("locus.deepagent", "Grounding"),
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def __getattr__(name: str) -> object:
|
|
136
|
+
"""Lazy import for Agent and model classes."""
|
|
137
|
+
if name in _LAZY_IMPORTS:
|
|
138
|
+
module_path, attr_name = _LAZY_IMPORTS[name]
|
|
139
|
+
import importlib
|
|
140
|
+
|
|
141
|
+
module = importlib.import_module(module_path)
|
|
142
|
+
return getattr(module, attr_name)
|
|
143
|
+
|
|
144
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
__version__ = "0.1.0"
|
|
148
|
+
__all__ = [
|
|
149
|
+
"Agent",
|
|
150
|
+
"AgentConfig",
|
|
151
|
+
"AgentResult",
|
|
152
|
+
"AgentState",
|
|
153
|
+
"CausalChain",
|
|
154
|
+
"END",
|
|
155
|
+
"GraphConfig",
|
|
156
|
+
"GroundingEvaluator",
|
|
157
|
+
"GroundingEvent",
|
|
158
|
+
"Handoff",
|
|
159
|
+
"HandoffContext",
|
|
160
|
+
"HandoffReason",
|
|
161
|
+
"HookProvider",
|
|
162
|
+
"HookRegistry",
|
|
163
|
+
"LocusError",
|
|
164
|
+
"LocusEvent",
|
|
165
|
+
"LocusSettings",
|
|
166
|
+
"LoopAgent",
|
|
167
|
+
"Message",
|
|
168
|
+
"Orchestrator",
|
|
169
|
+
"ParallelPipeline",
|
|
170
|
+
"ReflectEvent",
|
|
171
|
+
"Reflector",
|
|
172
|
+
"Reflexion",
|
|
173
|
+
"Role",
|
|
174
|
+
"RoutingDecision",
|
|
175
|
+
"START",
|
|
176
|
+
"Send",
|
|
177
|
+
"SequentialPipeline",
|
|
178
|
+
"Specialist",
|
|
179
|
+
"StateGraph",
|
|
180
|
+
"TerminateEvent",
|
|
181
|
+
"ThinkEvent",
|
|
182
|
+
"ToolCall",
|
|
183
|
+
"ToolCompleteEvent",
|
|
184
|
+
"ToolContext",
|
|
185
|
+
"ToolStartEvent",
|
|
186
|
+
"__version__",
|
|
187
|
+
"create_handoff_agent",
|
|
188
|
+
"create_handoff_manager",
|
|
189
|
+
"create_orchestrator",
|
|
190
|
+
"tool",
|
|
191
|
+
# RAG (lazy)
|
|
192
|
+
"RAGRetriever",
|
|
193
|
+
"OCIEmbeddings",
|
|
194
|
+
"OracleVectorStore",
|
|
195
|
+
# PRISM router (lazy)
|
|
196
|
+
"Capability",
|
|
197
|
+
"CapabilityIndex",
|
|
198
|
+
"CognitiveCompiler",
|
|
199
|
+
"Complexity",
|
|
200
|
+
"GoalFrame",
|
|
201
|
+
"PolicyGate",
|
|
202
|
+
"PolicyVerdict",
|
|
203
|
+
"Protocol",
|
|
204
|
+
"ProtocolRegistry",
|
|
205
|
+
"Risk",
|
|
206
|
+
"Router",
|
|
207
|
+
"RunnableResult",
|
|
208
|
+
"SkillIndex",
|
|
209
|
+
"TaskType",
|
|
210
|
+
"builtin_protocols",
|
|
211
|
+
# Deep research — agent factory (lazy)
|
|
212
|
+
"create_deepagent",
|
|
213
|
+
"KnowledgeProvider",
|
|
214
|
+
"KnowledgeRow",
|
|
215
|
+
"ItemRef",
|
|
216
|
+
"Grounding",
|
|
217
|
+
# Deep research — research workflow primitives (lazy)
|
|
218
|
+
"create_research_workflow",
|
|
219
|
+
"make_execute_node",
|
|
220
|
+
"make_causal_inference_node",
|
|
221
|
+
"make_summarize_node",
|
|
222
|
+
"make_grounding_eval_node",
|
|
223
|
+
"make_regenerate_summary_node",
|
|
224
|
+
"make_replan_node",
|
|
225
|
+
"route_after_grounding",
|
|
226
|
+
# Research workflow state keys (lazy)
|
|
227
|
+
"KEY_PROMPT",
|
|
228
|
+
"KEY_EXECUTE_PROMPT",
|
|
229
|
+
"KEY_EVIDENCE",
|
|
230
|
+
"KEY_GROUNDING_FACTS",
|
|
231
|
+
"KEY_CAUSAL_CHAIN",
|
|
232
|
+
"KEY_CAUSAL_HYPOTHESIS",
|
|
233
|
+
"KEY_CAUSAL_CONFIDENCE",
|
|
234
|
+
"KEY_SUMMARY",
|
|
235
|
+
"KEY_STRUCTURED_OUTPUT",
|
|
236
|
+
"KEY_GROUNDING_SCORE",
|
|
237
|
+
"KEY_UNGROUNDED_CLAIMS",
|
|
238
|
+
"KEY_REPLAN_COUNT",
|
|
239
|
+
"KEY_REGENERATION_COUNT",
|
|
240
|
+
"KEY_STOP_REASON",
|
|
241
|
+
]
|
locus/a2a/__init__.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Copyright (c) 2025, 2026 Oracle and/or its affiliates.
|
|
2
|
+
# Licensed under the Universal Permissive License v1.0 as shown at
|
|
3
|
+
# https://oss.oracle.com/licenses/upl/
|
|
4
|
+
|
|
5
|
+
"""Agent-to-Agent (A2A) protocol — spec-compliant cross-framework interop.
|
|
6
|
+
|
|
7
|
+
Implements the public A2A protocol (https://a2aproject.github.io/A2A/)
|
|
8
|
+
so Locus agents can talk to peers from other frameworks (Strands, ADK,
|
|
9
|
+
Google A2A SDKs) without a translation shim.
|
|
10
|
+
|
|
11
|
+
Wire surface served by :class:`A2AServer`:
|
|
12
|
+
|
|
13
|
+
- ``GET /.well-known/agent-card.json`` — public Agent Card (spec §5.5)
|
|
14
|
+
- ``POST /`` — JSON-RPC 2.0 method dispatch
|
|
15
|
+
(``message/send``, ``message/stream``, ``tasks/get``,
|
|
16
|
+
``tasks/cancel``)
|
|
17
|
+
- Backwards-compat: ``GET /agent-card``, ``POST /a2a/{invoke,stream}``
|
|
18
|
+
|
|
19
|
+
Re-exports the spec models so consumers can do ``from locus.a2a import
|
|
20
|
+
AgentCard, AgentSkill, Message, TextPart, Task`` directly.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from locus.a2a.protocol import (
|
|
24
|
+
A2AClient,
|
|
25
|
+
A2AMessage,
|
|
26
|
+
A2ARequest,
|
|
27
|
+
A2AResponse,
|
|
28
|
+
A2AServer,
|
|
29
|
+
)
|
|
30
|
+
from locus.a2a.spec import (
|
|
31
|
+
AgentCapabilities,
|
|
32
|
+
AgentCard,
|
|
33
|
+
AgentProvider,
|
|
34
|
+
AgentSkill,
|
|
35
|
+
Artifact,
|
|
36
|
+
DataPart,
|
|
37
|
+
FilePart,
|
|
38
|
+
FileWithBytes,
|
|
39
|
+
FileWithUri,
|
|
40
|
+
JsonRpcError,
|
|
41
|
+
JsonRpcErrorResponse,
|
|
42
|
+
JsonRpcRequest,
|
|
43
|
+
JsonRpcSuccessResponse,
|
|
44
|
+
Message,
|
|
45
|
+
MessageSendConfiguration,
|
|
46
|
+
MessageSendParams,
|
|
47
|
+
Part,
|
|
48
|
+
PushNotificationAuthenticationInfo,
|
|
49
|
+
PushNotificationConfig,
|
|
50
|
+
Task,
|
|
51
|
+
TaskArtifactUpdateEvent,
|
|
52
|
+
TaskIdParams,
|
|
53
|
+
TaskPushNotificationConfig,
|
|
54
|
+
TaskQueryParams,
|
|
55
|
+
TaskState,
|
|
56
|
+
TaskStatus,
|
|
57
|
+
TaskStatusUpdateEvent,
|
|
58
|
+
TextPart,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
__all__ = [
|
|
63
|
+
# Server / client.
|
|
64
|
+
"A2AClient",
|
|
65
|
+
"A2AServer",
|
|
66
|
+
# Spec models.
|
|
67
|
+
"AgentCapabilities",
|
|
68
|
+
"AgentCard",
|
|
69
|
+
"AgentProvider",
|
|
70
|
+
"AgentSkill",
|
|
71
|
+
"Artifact",
|
|
72
|
+
"DataPart",
|
|
73
|
+
"FilePart",
|
|
74
|
+
"FileWithBytes",
|
|
75
|
+
"FileWithUri",
|
|
76
|
+
"JsonRpcError",
|
|
77
|
+
"JsonRpcErrorResponse",
|
|
78
|
+
"JsonRpcRequest",
|
|
79
|
+
"JsonRpcSuccessResponse",
|
|
80
|
+
"Message",
|
|
81
|
+
"MessageSendConfiguration",
|
|
82
|
+
"MessageSendParams",
|
|
83
|
+
"Part",
|
|
84
|
+
"PushNotificationAuthenticationInfo",
|
|
85
|
+
"PushNotificationConfig",
|
|
86
|
+
"Task",
|
|
87
|
+
"TaskArtifactUpdateEvent",
|
|
88
|
+
"TaskIdParams",
|
|
89
|
+
"TaskPushNotificationConfig",
|
|
90
|
+
"TaskQueryParams",
|
|
91
|
+
"TaskState",
|
|
92
|
+
"TaskStatus",
|
|
93
|
+
"TaskStatusUpdateEvent",
|
|
94
|
+
"TextPart",
|
|
95
|
+
# Legacy flat models (kept for the pre-spec wire surface).
|
|
96
|
+
"A2AMessage",
|
|
97
|
+
"A2ARequest",
|
|
98
|
+
"A2AResponse",
|
|
99
|
+
]
|