multiagentos 0.4.0__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.
- agents/__init__.py +1 -0
- agents/catalog.py +52 -0
- agents/registry.py +11 -0
- core/__init__.py +38 -0
- core/artifacts.py +47 -0
- core/chat_agent_bridge.py +280 -0
- core/chat_agent_registry.py +61 -0
- core/chat_agent_router.py +85 -0
- core/chat_session.py +62 -0
- core/contracts/__init__.py +22 -0
- core/contracts/agent.py +21 -0
- core/contracts/ai.py +25 -0
- core/contracts/capability.py +44 -0
- core/contracts/chat_agent.py +34 -0
- core/contracts/checkpoint.py +78 -0
- core/contracts/discovery.py +30 -0
- core/contracts/execution.py +28 -0
- core/contracts/github.py +74 -0
- core/contracts/handoff.py +56 -0
- core/contracts/health.py +206 -0
- core/contracts/human_review.py +20 -0
- core/contracts/ide.py +113 -0
- core/contracts/mcp.py +76 -0
- core/contracts/model_runtime.py +25 -0
- core/contracts/planning.py +25 -0
- core/contracts/profile.py +66 -0
- core/contracts/quota.py +62 -0
- core/contracts/repository.py +34 -0
- core/contracts/resume.py +55 -0
- core/contracts/runtime.py +19 -0
- core/contracts/vyrelon_runtime.py +118 -0
- core/contracts/work_unit.py +48 -0
- core/delegation.py +33 -0
- core/handoff.py +68 -0
- core/lifecycle.py +85 -0
- core/multi_agent_workflow.py +574 -0
- core/orchestrator.py +51 -0
- core/planning.py +22 -0
- core/registry.py +44 -0
- core/routing.py +195 -0
- core/state.py +155 -0
- installer/__init__.py +1 -0
- installer/init.py +71 -0
- integrations/__init__.py +0 -0
- integrations/github/__init__.py +3 -0
- integrations/github/gateway.py +164 -0
- integrations/openai/__init__.py +1 -0
- integrations/openai/chat_agent.py +147 -0
- multiagentos/__init__.py +1 -0
- multiagentos/cli.py +759 -0
- multiagentos-0.4.0.dist-info/METADATA +7 -0
- multiagentos-0.4.0.dist-info/RECORD +122 -0
- multiagentos-0.4.0.dist-info/WHEEL +5 -0
- multiagentos-0.4.0.dist-info/entry_points.txt +2 -0
- multiagentos-0.4.0.dist-info/top_level.txt +7 -0
- profiles/__init__.py +1 -0
- profiles/common.py +11 -0
- profiles/detector.py +67 -0
- profiles/registry.py +46 -0
- profiles/resolver.py +63 -0
- runtime/__init__.py +5 -0
- runtime/agent/__init__.py +1 -0
- runtime/agent/ide.py +74 -0
- runtime/agent/model.py +197 -0
- runtime/agent/model_backed.py +49 -0
- runtime/agent/process.py +21 -0
- runtime/builtin_tools.py +57 -0
- runtime/capability.py +143 -0
- runtime/chat_adapter_registry.py +43 -0
- runtime/chat_config.py +57 -0
- runtime/chat_execution.py +52 -0
- runtime/config/__init__.py +1 -0
- runtime/config/loader.py +67 -0
- runtime/discovery.py +334 -0
- runtime/execution_config.py +71 -0
- runtime/execution_registry.py +50 -0
- runtime/git.py +84 -0
- runtime/github.py +56 -0
- runtime/github_probe.py +23 -0
- runtime/health.py +14 -0
- runtime/ide/__init__.py +6 -0
- runtime/ide/bridge.py +198 -0
- runtime/ide/registry.py +24 -0
- runtime/ide/runtime.py +35 -0
- runtime/local/__init__.py +18 -0
- runtime/local/filesystem.py +58 -0
- runtime/local/patch.py +79 -0
- runtime/local/path_security.py +31 -0
- runtime/local/permissions.py +20 -0
- runtime/local/process.py +56 -0
- runtime/local/shell.py +97 -0
- runtime/mcp/__init__.py +7 -0
- runtime/mcp/client.py +120 -0
- runtime/mcp/config.py +36 -0
- runtime/mcp/policy.py +57 -0
- runtime/mcp/proxy.py +30 -0
- runtime/mcp/server.py +137 -0
- runtime/mcp/session.py +19 -0
- runtime/model/__init__.py +5 -0
- runtime/model/ai_runtime.py +165 -0
- runtime/model/cli.py +49 -0
- runtime/model/config.py +98 -0
- runtime/model/credentials.py +42 -0
- runtime/model/factory.py +82 -0
- runtime/model/http.py +78 -0
- runtime/model/invoker.py +16 -0
- runtime/model/materializer.py +101 -0
- runtime/model/native.py +244 -0
- runtime/model/providers.py +55 -0
- runtime/model/registry.py +26 -0
- runtime/model/runtime_loader.py +51 -0
- runtime/model_control.py +136 -0
- runtime/multi_agent.py +142 -0
- runtime/policy.py +28 -0
- runtime/process.py +41 -0
- runtime/quota.py +259 -0
- runtime/repository.py +103 -0
- runtime/repository_tools.py +62 -0
- runtime/status.py +87 -0
- runtime/tool_calling.py +134 -0
- runtime/validation.py +121 -0
- runtime/vyrelon.py +1557 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"""OpenAI Chat Agent adapter for VYRELON.
|
|
2
|
+
|
|
3
|
+
This adapter is optional: the core remains provider-neutral and does not require
|
|
4
|
+
an OpenAI SDK or API key at import time.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from core.chat_agent_bridge import (
|
|
14
|
+
ChatAgentAdapter,
|
|
15
|
+
ChatAgentRequest,
|
|
16
|
+
ChatAgentResponse,
|
|
17
|
+
)
|
|
18
|
+
from core.contracts.chat_agent import ChatAgentContract
|
|
19
|
+
from core.contracts.planning import PlanStep
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class OpenAIChatAgentAdapter:
|
|
23
|
+
"""Connect a ChatGPT-class agent to the provider-neutral Chat Agent bridge."""
|
|
24
|
+
|
|
25
|
+
def __init__(self, client: Any | None = None, model: str | None = None) -> None:
|
|
26
|
+
self.model = model or os.environ.get("VYRELON_OPENAI_MODEL") or os.environ.get(
|
|
27
|
+
"OPENAI_MODEL"
|
|
28
|
+
)
|
|
29
|
+
self._client = client
|
|
30
|
+
|
|
31
|
+
def _client_or_create(self) -> Any:
|
|
32
|
+
if self._client is not None:
|
|
33
|
+
return self._client
|
|
34
|
+
try:
|
|
35
|
+
from openai import OpenAI
|
|
36
|
+
except ImportError as exc:
|
|
37
|
+
raise RuntimeError(
|
|
38
|
+
"OpenAI Chat Agent support requires the optional 'openai' package"
|
|
39
|
+
) from exc
|
|
40
|
+
self._client = OpenAI()
|
|
41
|
+
return self._client
|
|
42
|
+
|
|
43
|
+
def respond(
|
|
44
|
+
self,
|
|
45
|
+
*,
|
|
46
|
+
agent: ChatAgentContract,
|
|
47
|
+
instructions: str,
|
|
48
|
+
request: ChatAgentRequest,
|
|
49
|
+
) -> ChatAgentResponse:
|
|
50
|
+
if not self.model:
|
|
51
|
+
raise ValueError(
|
|
52
|
+
"Set VYRELON_OPENAI_MODEL or OPENAI_MODEL for the OpenAI Chat Agent adapter"
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
client = self._client_or_create()
|
|
56
|
+
response = client.responses.create(
|
|
57
|
+
model=self.model,
|
|
58
|
+
instructions=instructions,
|
|
59
|
+
input=self._build_input(request),
|
|
60
|
+
)
|
|
61
|
+
text = getattr(response, "output_text", "") or ""
|
|
62
|
+
parsed = self._parse_structured_response(text, request)
|
|
63
|
+
return ChatAgentResponse(
|
|
64
|
+
summary=parsed["summary"],
|
|
65
|
+
steps=tuple(parsed["steps"]),
|
|
66
|
+
findings=tuple(parsed["findings"]),
|
|
67
|
+
artifacts=tuple(parsed["artifacts"]),
|
|
68
|
+
evidence=(
|
|
69
|
+
f"OpenAI response received from model {self.model}",
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
@staticmethod
|
|
74
|
+
def _build_input(request: ChatAgentRequest) -> str:
|
|
75
|
+
payload = {
|
|
76
|
+
"objective": request.objective,
|
|
77
|
+
"inputs": request.inputs or {},
|
|
78
|
+
"required_output": {
|
|
79
|
+
"summary": "string",
|
|
80
|
+
"steps": [
|
|
81
|
+
{
|
|
82
|
+
"id": "string",
|
|
83
|
+
"objective": "string",
|
|
84
|
+
"agent_id": "optional string",
|
|
85
|
+
"depends_on": ["step id"],
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"findings": ["string"],
|
|
89
|
+
"artifacts": ["string"],
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
return (
|
|
93
|
+
"Return ONLY valid JSON matching this schema. Do not claim that any "
|
|
94
|
+
"filesystem, Git, GitHub, or other external action was performed. "
|
|
95
|
+
"Those actions belong to VYRELON runtime.\n\n"
|
|
96
|
+
+ json.dumps(payload, ensure_ascii=False)
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
@staticmethod
|
|
100
|
+
def _parse_structured_response(text: str, request: ChatAgentRequest) -> dict[str, Any]:
|
|
101
|
+
try:
|
|
102
|
+
data = json.loads(text)
|
|
103
|
+
except json.JSONDecodeError:
|
|
104
|
+
return {
|
|
105
|
+
"summary": text.strip() or "No structured response returned.",
|
|
106
|
+
"steps": [
|
|
107
|
+
PlanStep(
|
|
108
|
+
id="chat-understanding",
|
|
109
|
+
objective=request.objective,
|
|
110
|
+
)
|
|
111
|
+
],
|
|
112
|
+
"findings": (),
|
|
113
|
+
"artifacts": (),
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
steps = []
|
|
117
|
+
for index, item in enumerate(data.get("steps", []), 1):
|
|
118
|
+
if not isinstance(item, dict):
|
|
119
|
+
continue
|
|
120
|
+
objective = str(item.get("objective", "")).strip()
|
|
121
|
+
if not objective:
|
|
122
|
+
continue
|
|
123
|
+
step_id = str(item.get("id", f"step-{index}")).strip() or f"step-{index}"
|
|
124
|
+
depends_on = tuple(str(value) for value in item.get("depends_on", []))
|
|
125
|
+
steps.append(
|
|
126
|
+
PlanStep(
|
|
127
|
+
id=step_id,
|
|
128
|
+
objective=objective,
|
|
129
|
+
agent_id=item.get("agent_id"),
|
|
130
|
+
depends_on=depends_on,
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
if not steps:
|
|
135
|
+
steps = [
|
|
136
|
+
PlanStep(
|
|
137
|
+
id="chat-understanding",
|
|
138
|
+
objective=request.objective,
|
|
139
|
+
)
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
"summary": str(data.get("summary", "")).strip() or "Plan prepared.",
|
|
144
|
+
"steps": steps,
|
|
145
|
+
"findings": tuple(str(value) for value in data.get("findings", [])),
|
|
146
|
+
"artifacts": tuple(str(value) for value in data.get("artifacts", [])),
|
|
147
|
+
}
|
multiagentos/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""MultiAgentOS command-line package."""
|