infrarely 0.1.0__tar.gz
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.
- infrarely-0.1.0/LICENSE +21 -0
- infrarely-0.1.0/PKG-INFO +340 -0
- infrarely-0.1.0/README.md +293 -0
- infrarely-0.1.0/infrarely/__init__.py +620 -0
- infrarely-0.1.0/infrarely/__main__.py +6 -0
- infrarely-0.1.0/infrarely/agent/__init__.py +1 -0
- infrarely-0.1.0/infrarely/agent/capability.py +262 -0
- infrarely-0.1.0/infrarely/agent/capability_compiler.py +350 -0
- infrarely-0.1.0/infrarely/agent/capability_executor.py +502 -0
- infrarely-0.1.0/infrarely/agent/capability_graph.py +309 -0
- infrarely-0.1.0/infrarely/agent/capability_resolver.py +181 -0
- infrarely-0.1.0/infrarely/agent/context_builder.py +102 -0
- infrarely-0.1.0/infrarely/agent/error_recovery.py +87 -0
- infrarely-0.1.0/infrarely/agent/execution_depth.py +38 -0
- infrarely-0.1.0/infrarely/agent/execution_trace.py +175 -0
- infrarely-0.1.0/infrarely/agent/graph.py +155 -0
- infrarely-0.1.0/infrarely/agent/knowledge_layer.py +1542 -0
- infrarely-0.1.0/infrarely/agent/llm_client.py +554 -0
- infrarely-0.1.0/infrarely/agent/nodes.py +435 -0
- infrarely-0.1.0/infrarely/agent/permission_policy.py +78 -0
- infrarely-0.1.0/infrarely/agent/pipeline.py +1054 -0
- infrarely-0.1.0/infrarely/agent/planning_engine.py +1285 -0
- infrarely-0.1.0/infrarely/agent/reasoning_engine.py +139 -0
- infrarely-0.1.0/infrarely/agent/response_formatter.py +101 -0
- infrarely-0.1.0/infrarely/agent/scheduler.py +113 -0
- infrarely-0.1.0/infrarely/agent/state.py +290 -0
- infrarely-0.1.0/infrarely/agent/state_machine.py +1108 -0
- infrarely-0.1.0/infrarely/agent/tool_sandbox.py +79 -0
- infrarely-0.1.0/infrarely/agent/tool_validator.py +57 -0
- infrarely-0.1.0/infrarely/agent/verification.py +496 -0
- infrarely-0.1.0/infrarely/agent/workflow.py +146 -0
- infrarely-0.1.0/infrarely/capabilities/__init__.py +1 -0
- infrarely-0.1.0/infrarely/capabilities/registry.py +129 -0
- infrarely-0.1.0/infrarely/capabilities/student_capabilities.py +182 -0
- infrarely-0.1.0/infrarely/cli/__init__.py +1 -0
- infrarely-0.1.0/infrarely/cli/cli.py +1119 -0
- infrarely-0.1.0/infrarely/core/__init__.py +6 -0
- infrarely-0.1.0/infrarely/core/agent.py +1543 -0
- infrarely-0.1.0/infrarely/core/app_config.py +182 -0
- infrarely-0.1.0/infrarely/core/config.py +313 -0
- infrarely-0.1.0/infrarely/core/context.py +426 -0
- infrarely-0.1.0/infrarely/core/decorators.py +539 -0
- infrarely-0.1.0/infrarely/core/events.py +505 -0
- infrarely-0.1.0/infrarely/core/result.py +383 -0
- infrarely-0.1.0/infrarely/core/streaming.py +271 -0
- infrarely-0.1.0/infrarely/integrations/__init__.py +65 -0
- infrarely-0.1.0/infrarely/integrations/github.py +152 -0
- infrarely-0.1.0/infrarely/integrations/gmail.py +70 -0
- infrarely-0.1.0/infrarely/integrations/notion.py +94 -0
- infrarely-0.1.0/infrarely/integrations/postgres.py +81 -0
- infrarely-0.1.0/infrarely/integrations/rest_api.py +84 -0
- infrarely-0.1.0/infrarely/integrations/slack.py +96 -0
- infrarely-0.1.0/infrarely/integrations/webhook.py +86 -0
- infrarely-0.1.0/infrarely/internal/__init__.py +1 -0
- infrarely-0.1.0/infrarely/internal/bridge.py +1247 -0
- infrarely-0.1.0/infrarely/internal/knowledge_bridge.py +41 -0
- infrarely-0.1.0/infrarely/internal/plan_bridge.py +74 -0
- infrarely-0.1.0/infrarely/internal/state_bridge.py +130 -0
- infrarely-0.1.0/infrarely/learning/__init__.py +1 -0
- infrarely-0.1.0/infrarely/learning/architecture_optimizer.py +292 -0
- infrarely-0.1.0/infrarely/learning/capability_evolution.py +313 -0
- infrarely-0.1.0/infrarely/learning/evolution_memory.py +196 -0
- infrarely-0.1.0/infrarely/learning/experimentation_engine.py +311 -0
- infrarely-0.1.0/infrarely/learning/failure_intelligence.py +309 -0
- infrarely-0.1.0/infrarely/learning/performance_intelligence.py +385 -0
- infrarely-0.1.0/infrarely/learning/policy_guard.py +251 -0
- infrarely-0.1.0/infrarely/learning/verification_layer.py +305 -0
- infrarely-0.1.0/infrarely/memory/__init__.py +1 -0
- infrarely-0.1.0/infrarely/memory/advance_memory.py +165 -0
- infrarely-0.1.0/infrarely/memory/knowledge.py +796 -0
- infrarely-0.1.0/infrarely/memory/long_term.py +95 -0
- infrarely-0.1.0/infrarely/memory/memory.py +792 -0
- infrarely-0.1.0/infrarely/memory/memory_manager.py +398 -0
- infrarely-0.1.0/infrarely/memory/structured.py +158 -0
- infrarely-0.1.0/infrarely/memory/working.py +74 -0
- infrarely-0.1.0/infrarely/observability/__init__.py +1 -0
- infrarely-0.1.0/infrarely/observability/dashboard.py +253 -0
- infrarely-0.1.0/infrarely/observability/logger.py +405 -0
- infrarely-0.1.0/infrarely/observability/metrics.py +89 -0
- infrarely-0.1.0/infrarely/observability/observability.py +693 -0
- infrarely-0.1.0/infrarely/observability/token_budget.py +168 -0
- infrarely-0.1.0/infrarely/optimization/__init__.py +1 -0
- infrarely-0.1.0/infrarely/optimization/capability_discovery.py +200 -0
- infrarely-0.1.0/infrarely/optimization/capability_optimizer.py +296 -0
- infrarely-0.1.0/infrarely/optimization/failure_analyzer.py +217 -0
- infrarely-0.1.0/infrarely/optimization/parameter_inference.py +236 -0
- infrarely-0.1.0/infrarely/optimization/quality_scorer.py +180 -0
- infrarely-0.1.0/infrarely/optimization/routing_optimizer.py +146 -0
- infrarely-0.1.0/infrarely/optimization/safety_controller.py +173 -0
- infrarely-0.1.0/infrarely/optimization/skill_memory.py +224 -0
- infrarely-0.1.0/infrarely/optimization/token_optimizer.py +172 -0
- infrarely-0.1.0/infrarely/optimization/trace_intelligence.py +183 -0
- infrarely-0.1.0/infrarely/platform/__init__.py +1 -0
- infrarely-0.1.0/infrarely/platform/acp.py +1029 -0
- infrarely-0.1.0/infrarely/platform/benchmark.py +1668 -0
- infrarely-0.1.0/infrarely/platform/evaluation.py +681 -0
- infrarely-0.1.0/infrarely/platform/hitl.py +468 -0
- infrarely-0.1.0/infrarely/platform/marketplace.py +1063 -0
- infrarely-0.1.0/infrarely/platform/multitenancy.py +406 -0
- infrarely-0.1.0/infrarely/platform/nlconfig.py +1305 -0
- infrarely-0.1.0/infrarely/platform/self_heal.py +695 -0
- infrarely-0.1.0/infrarely/platform/sync.py +322 -0
- infrarely-0.1.0/infrarely/platform/testing.py +459 -0
- infrarely-0.1.0/infrarely/platform/token_tracking.py +359 -0
- infrarely-0.1.0/infrarely/platform/tool_sandbox.py +349 -0
- infrarely-0.1.0/infrarely/platform/validation.py +485 -0
- infrarely-0.1.0/infrarely/platform/versioning.py +472 -0
- infrarely-0.1.0/infrarely/py.typed +0 -0
- infrarely-0.1.0/infrarely/router/__init__.py +1 -0
- infrarely-0.1.0/infrarely/router/intent_classifier.py +449 -0
- infrarely-0.1.0/infrarely/router/tool_router.py +151 -0
- infrarely-0.1.0/infrarely/runtime/__init__.py +1 -0
- infrarely-0.1.0/infrarely/runtime/agent_monitoring.py +345 -0
- infrarely-0.1.0/infrarely/runtime/agent_registry.py +275 -0
- infrarely-0.1.0/infrarely/runtime/agent_scheduler.py +401 -0
- infrarely-0.1.0/infrarely/runtime/async_runner.py +216 -0
- infrarely-0.1.0/infrarely/runtime/capability_load_balancer.py +212 -0
- infrarely-0.1.0/infrarely/runtime/capability_market.py +292 -0
- infrarely-0.1.0/infrarely/runtime/capability_reputation.py +279 -0
- infrarely-0.1.0/infrarely/runtime/deadlock_detector.py +266 -0
- infrarely-0.1.0/infrarely/runtime/distributed_scalability.py +232 -0
- infrarely-0.1.0/infrarely/runtime/global_resource_governance.py +253 -0
- infrarely-0.1.0/infrarely/runtime/identity_permissions.py +342 -0
- infrarely-0.1.0/infrarely/runtime/lifecycle_manager.py +332 -0
- infrarely-0.1.0/infrarely/runtime/message_bus.py +319 -0
- infrarely-0.1.0/infrarely/runtime/negotiation_protocol.py +388 -0
- infrarely-0.1.0/infrarely/runtime/negotiation_timeouts.py +219 -0
- infrarely-0.1.0/infrarely/runtime/priority_scheduler.py +252 -0
- infrarely-0.1.0/infrarely/runtime/resource_isolation.py +287 -0
- infrarely-0.1.0/infrarely/runtime/sandbox.py +397 -0
- infrarely-0.1.0/infrarely/runtime/scaling.py +498 -0
- infrarely-0.1.0/infrarely/runtime/security_sandbox.py +241 -0
- infrarely-0.1.0/infrarely/runtime/shared_memory.py +331 -0
- infrarely-0.1.0/infrarely/runtime/state_persistence.py +266 -0
- infrarely-0.1.0/infrarely/runtime/task_graph.py +340 -0
- infrarely-0.1.0/infrarely/runtime/workflow.py +613 -0
- infrarely-0.1.0/infrarely/security/__init__.py +1 -0
- infrarely-0.1.0/infrarely/security/compliance.py +420 -0
- infrarely-0.1.0/infrarely/security/input_sanitizer.py +275 -0
- infrarely-0.1.0/infrarely/security/key_rotation.py +284 -0
- infrarely-0.1.0/infrarely/security/security.py +702 -0
- infrarely-0.1.0/infrarely/tools/__init__.py +1 -0
- infrarely-0.1.0/infrarely/tools/base_tool.py +206 -0
- infrarely-0.1.0/infrarely/tools/registry.py +71 -0
- infrarely-0.1.0/infrarely.egg-info/PKG-INFO +340 -0
- infrarely-0.1.0/infrarely.egg-info/SOURCES.txt +159 -0
- infrarely-0.1.0/infrarely.egg-info/dependency_links.txt +1 -0
- infrarely-0.1.0/infrarely.egg-info/entry_points.txt +2 -0
- infrarely-0.1.0/infrarely.egg-info/requires.txt +28 -0
- infrarely-0.1.0/infrarely.egg-info/top_level.txt +1 -0
- infrarely-0.1.0/pyproject.toml +90 -0
- infrarely-0.1.0/setup.cfg +4 -0
- infrarely-0.1.0/tests/test_beginner.py +138 -0
- infrarely-0.1.0/tests/test_config.py +67 -0
- infrarely-0.1.0/tests/test_errors.py +97 -0
- infrarely-0.1.0/tests/test_knowledge.py +92 -0
- infrarely-0.1.0/tests/test_memory.py +121 -0
- infrarely-0.1.0/tests/test_multi_agent.py +141 -0
- infrarely-0.1.0/tests/test_observability.py +128 -0
- infrarely-0.1.0/tests/test_tools.py +121 -0
- infrarely-0.1.0/tests/test_workflow.py +182 -0
infrarely-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 InfraRely
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
infrarely-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: infrarely
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: InfraRely — Reliable Agent Infrastructure. Production-grade agent framework with zero boilerplate.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/infrarely/infrarely
|
|
7
|
+
Project-URL: Documentation, https://infrarely.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/infrarely/infrarely
|
|
9
|
+
Project-URL: Issues, https://github.com/infrarely/infrarely/issues
|
|
10
|
+
Keywords: agent,ai,llm,sdk,multi-agent,knowledge,workflow,infrastructure,reliable
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: openai
|
|
26
|
+
Requires-Dist: openai>=1.0; extra == "openai"
|
|
27
|
+
Provides-Extra: anthropic
|
|
28
|
+
Requires-Dist: anthropic>=0.20; extra == "anthropic"
|
|
29
|
+
Provides-Extra: groq
|
|
30
|
+
Requires-Dist: groq>=0.4; extra == "groq"
|
|
31
|
+
Provides-Extra: google
|
|
32
|
+
Requires-Dist: google-generativeai>=0.4; extra == "google"
|
|
33
|
+
Provides-Extra: ollama
|
|
34
|
+
Requires-Dist: ollama>=0.1; extra == "ollama"
|
|
35
|
+
Provides-Extra: all-providers
|
|
36
|
+
Requires-Dist: openai>=1.0; extra == "all-providers"
|
|
37
|
+
Requires-Dist: anthropic>=0.20; extra == "all-providers"
|
|
38
|
+
Requires-Dist: groq>=0.4; extra == "all-providers"
|
|
39
|
+
Requires-Dist: google-generativeai>=0.4; extra == "all-providers"
|
|
40
|
+
Requires-Dist: ollama>=0.1; extra == "all-providers"
|
|
41
|
+
Provides-Extra: dev
|
|
42
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
43
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
44
|
+
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
45
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
[](https://www.python.org/downloads/)
|
|
49
|
+
[](https://opensource.org/licenses/MIT)
|
|
50
|
+
[]()
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
# InfraRely
|
|
55
|
+
|
|
56
|
+
**Reliable Agent Infrastructure — Production-grade AI agent framework with zero boilerplate.**
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Why InfraRely?
|
|
61
|
+
|
|
62
|
+
Most AI agents today are unreliable when they move from demos to production.
|
|
63
|
+
|
|
64
|
+
### Common Problems
|
|
65
|
+
- **Non-deterministic execution** — behavior changes between runs, making debugging and incident response difficult
|
|
66
|
+
- **Hallucination (tool + response)** — models invent tool names, parameters, outputs, or unsupported claims
|
|
67
|
+
- **Poor observability** — limited traces make it hard to explain failures and regressions
|
|
68
|
+
- **Fragile multi-agent coordination** — delegation and message passing break under real workload pressure
|
|
69
|
+
- **Weak trust and accountability** — decisions are hard to audit, attribute, and defend in production
|
|
70
|
+
- **Identity breakdown** — unclear agent identity/permissions lead to unsafe cross-agent actions
|
|
71
|
+
- **Memory problems** — stale, conflicting, or ungrounded memory corrupts downstream decisions
|
|
72
|
+
|
|
73
|
+
InfraRely addresses these failures with infrastructure-first primitives:
|
|
74
|
+
|
|
75
|
+
- **Deterministic execution contracts** — router-first control flow with frozen plans and explicit fallbacks
|
|
76
|
+
- **Capability graphs** — dependency-aware workflows that compile and execute predictably
|
|
77
|
+
- **Verification layers** — structural, logical, knowledge, and policy checks on every result
|
|
78
|
+
- **Multi-agent runtime** — scheduler, message bus, shared memory, isolation, and deadlock-aware coordination
|
|
79
|
+
- **Identity and memory controls** — runtime identity/permissions plus scoped memory discipline for safer coordination
|
|
80
|
+
|
|
81
|
+
The result is an AI agent framework designed for reliability, auditability, and safe production deployment.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import infrarely
|
|
89
|
+
|
|
90
|
+
infrarely.configure(llm_provider="openai", api_key="sk-...")
|
|
91
|
+
|
|
92
|
+
agent = infrarely.agent("helper")
|
|
93
|
+
result = agent.run("What is 2+2?")
|
|
94
|
+
print(result.output) # 4 (no LLM call — deterministic math)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Install
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install infrarely
|
|
101
|
+
|
|
102
|
+
# With LLM provider extras:
|
|
103
|
+
pip install infrarely[openai]
|
|
104
|
+
pip install infrarely[anthropic]
|
|
105
|
+
pip install infrarely[all-providers]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Features
|
|
111
|
+
|
|
112
|
+
### Core Framework
|
|
113
|
+
- **3-line start** — `import infrarely` → `agent()` → `run()`
|
|
114
|
+
- **Errors-as-data** — `Result` objects with `.error`, never bare exceptions
|
|
115
|
+
- **LLM-as-last-resort** — Knowledge → Math → Tools → Capabilities → LLM
|
|
116
|
+
- **Observable by default** — traces, metrics, health checks on every agent
|
|
117
|
+
|
|
118
|
+
### 7-Layer Architecture
|
|
119
|
+
|
|
120
|
+
| Layer | Name | Description |
|
|
121
|
+
|-------|------|-------------|
|
|
122
|
+
| 1 | **Execution Contracts** | Deterministic routing, frozen execution plans, three-gate LLM isolation |
|
|
123
|
+
| 2 | **Capability Graphs** | Multi-step workflows with dependency resolution |
|
|
124
|
+
| 3 | **Infrastructure** | Execution depth guard, permissions, tool validation, sandboxing |
|
|
125
|
+
| 4 | **Verification** | Structural/logical/knowledge/policy checks on every result |
|
|
126
|
+
| 5 | **Adaptive Intelligence** | Self-optimizing routing, failure analysis, token optimization |
|
|
127
|
+
| 6 | **Multi-Agent Runtime** | OS-like kernel — scheduler, IPC, shared memory, RBAC, deadlock detection |
|
|
128
|
+
| 7 | **Autonomous Evolution** | Performance analysis, A/B testing, architecture proposals with policy guards |
|
|
129
|
+
|
|
130
|
+
### Tools & Knowledge
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
@infrarely.tool
|
|
134
|
+
def weather(city: str) -> str:
|
|
135
|
+
return f"Sunny in {city}"
|
|
136
|
+
|
|
137
|
+
agent = infrarely.agent("bot", tools=[weather])
|
|
138
|
+
result = agent.run("Weather in NYC?")
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
agent = infrarely.agent("tutor")
|
|
143
|
+
agent.knowledge.add_documents("./notes/")
|
|
144
|
+
result = agent.run("Explain photosynthesis")
|
|
145
|
+
# LLM bypassed if knowledge confidence >= 85%
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Multi-Agent
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
researcher = infrarely.agent("researcher")
|
|
152
|
+
writer = infrarely.agent("writer")
|
|
153
|
+
facts = researcher.run("Find facts about Mars")
|
|
154
|
+
article = writer.run("Write article", context=facts)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Workflows (DAG)
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
wf = infrarely.workflow("pipeline", steps=[
|
|
161
|
+
infrarely.step("fetch", fetch_data),
|
|
162
|
+
infrarely.step("process", process, depends_on=["fetch"]),
|
|
163
|
+
infrarely.step("report", generate_report, depends_on=["process"]),
|
|
164
|
+
])
|
|
165
|
+
results = wf.execute()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Streaming
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
for chunk in agent.stream("Write a poem"):
|
|
172
|
+
print(chunk.text, end="", flush=True)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Security
|
|
176
|
+
|
|
177
|
+
- Prompt injection defense (7 injection types)
|
|
178
|
+
- Input sanitization (always-on)
|
|
179
|
+
- API key rotation
|
|
180
|
+
- Tool execution sandboxing
|
|
181
|
+
- Compliance audit logging
|
|
182
|
+
|
|
183
|
+
### Human-in-the-Loop
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
agent.require_approval_for("send_email", auto_approve_after=300)
|
|
187
|
+
result = agent.run("Send welcome email")
|
|
188
|
+
# Pauses for human approval
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### CLI
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
infrarely run "What is 2+2?"
|
|
195
|
+
infrarely health
|
|
196
|
+
infrarely metrics
|
|
197
|
+
infrarely deploy
|
|
198
|
+
infrarely verify
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## InfraRely Architecture
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
Applications
|
|
207
|
+
│
|
|
208
|
+
│
|
|
209
|
+
AI Agents Layer
|
|
210
|
+
(Custom Agents Built by Developers)
|
|
211
|
+
│
|
|
212
|
+
│
|
|
213
|
+
InfraRely Agent Control Plane
|
|
214
|
+
┌─────────────────────────────────────────┐
|
|
215
|
+
│ │
|
|
216
|
+
│ Agent Pipeline │
|
|
217
|
+
│ • Planning Engine │
|
|
218
|
+
│ • Capability Graph │
|
|
219
|
+
│ • Tool Router │
|
|
220
|
+
│ • Verification Layer │
|
|
221
|
+
│ │
|
|
222
|
+
│ Platform Services │
|
|
223
|
+
│ • Memory System │
|
|
224
|
+
│ • Knowledge Engine │
|
|
225
|
+
│ • Workflow DAG Engine │
|
|
226
|
+
│ • Capability Registry │
|
|
227
|
+
│ │
|
|
228
|
+
│ Reliability Systems │
|
|
229
|
+
│ • Retry & Circuit Breakers │
|
|
230
|
+
│ • Token Optimization │
|
|
231
|
+
│ • Failure Recovery │
|
|
232
|
+
│ • Self-Healing Execution │
|
|
233
|
+
│ │
|
|
234
|
+
│ Observability │
|
|
235
|
+
│ • Execution Traces │
|
|
236
|
+
│ • Metrics & Telemetry │
|
|
237
|
+
│ • Token Budget Monitoring │
|
|
238
|
+
│ │
|
|
239
|
+
│ Security │
|
|
240
|
+
│ • Input Sanitization │
|
|
241
|
+
│ • Tool Sandbox │
|
|
242
|
+
│ • Permission Policies │
|
|
243
|
+
│ • Compliance Logging │
|
|
244
|
+
└─────────────────────────────────────────┘
|
|
245
|
+
│
|
|
246
|
+
│
|
|
247
|
+
InfraRely Runtime
|
|
248
|
+
(Scheduling, Isolation, State, Scaling)
|
|
249
|
+
│
|
|
250
|
+
│
|
|
251
|
+
External Systems / APIs
|
|
252
|
+
Databases • SaaS APIs • Filesystems • LLM Providers
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Architecture
|
|
256
|
+
|
|
257
|
+
InfraRely is structured as a layered **Agent Operating System**.
|
|
258
|
+
|
|
259
|
+
1. **Applications**
|
|
260
|
+
- Developer-built AI applications.
|
|
261
|
+
|
|
262
|
+
2. **Agents**
|
|
263
|
+
- Logical workers that execute tasks and coordinate tools.
|
|
264
|
+
|
|
265
|
+
3. **InfraRely Control Plane**
|
|
266
|
+
- Planning, routing, verification, and reliability systems.
|
|
267
|
+
|
|
268
|
+
4. **Runtime**
|
|
269
|
+
- Execution environment responsible for scheduling, isolation, and scalability.
|
|
270
|
+
|
|
271
|
+
5. **External Systems**
|
|
272
|
+
- APIs, databases, and LLM providers used by agents.
|
|
273
|
+
|
|
274
|
+
### Project Structure
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
infrarely/
|
|
278
|
+
├── core/ # Agent, Result, Config, Events, Decorators, Streaming
|
|
279
|
+
├── runtime/ # Workflow DAG, async runner, sandbox, scaling, multi-agent kernel
|
|
280
|
+
├── router/ # Rule-based intent classification, tool routing
|
|
281
|
+
├── agent/ # Execution pipeline, state machine, planning, verification
|
|
282
|
+
├── memory/ # Agent memory, knowledge engine, working/structured/long-term
|
|
283
|
+
├── security/ # Prompt injection defense, compliance, input sanitization
|
|
284
|
+
├── observability/ # Metrics, traces, logging, dashboard
|
|
285
|
+
├── optimization/ # Self-optimizing routing, failure analysis, token optimization
|
|
286
|
+
├── learning/ # A/B testing, architecture proposals, policy guards
|
|
287
|
+
├── platform/ # HITL, evaluation, versioning, marketplace, multitenancy, ACP
|
|
288
|
+
├── tools/ # Tool base classes, registry
|
|
289
|
+
├── capabilities/ # Multi-step capability definitions
|
|
290
|
+
├── integrations/ # GitHub, Gmail, Slack, Postgres, Notion, Webhooks, REST
|
|
291
|
+
├── internal/ # Execution engine bridges (private)
|
|
292
|
+
└── cli/ # CLI interface
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## LLM Providers
|
|
296
|
+
|
|
297
|
+
| Provider | Model | Setup |
|
|
298
|
+
|----------|-------|-------|
|
|
299
|
+
| OpenAI | gpt-4o, gpt-4o-mini | `infrarely.configure(llm_provider="openai", api_key="sk-...")` |
|
|
300
|
+
| Anthropic | claude-sonnet-4-20250514 | `infrarely.configure(llm_provider="anthropic", api_key="...")` |
|
|
301
|
+
| Groq | llama-3.1-8b-instant | `infrarely.configure(llm_provider="groq", api_key="...")` |
|
|
302
|
+
| Google Gemini | gemini-1.5-flash | `infrarely.configure(llm_provider="gemini", api_key="...")` |
|
|
303
|
+
| Ollama | llama3.2 (local) | `infrarely.configure(llm_provider="ollama")` |
|
|
304
|
+
|
|
305
|
+
## Configuration
|
|
306
|
+
|
|
307
|
+
```python
|
|
308
|
+
infrarely.configure(
|
|
309
|
+
llm_provider="openai",
|
|
310
|
+
api_key="sk-...",
|
|
311
|
+
llm_model="gpt-4o",
|
|
312
|
+
knowledge_threshold=0.85,
|
|
313
|
+
token_budget=10_000,
|
|
314
|
+
log_level="INFO",
|
|
315
|
+
max_agents=50,
|
|
316
|
+
)
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Or via environment variables:
|
|
320
|
+
```bash
|
|
321
|
+
export INFRARELY_LLM_PROVIDER=openai
|
|
322
|
+
export INFRARELY_API_KEY=sk-...
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Documentation
|
|
326
|
+
|
|
327
|
+
- [Quickstart](docs/quickstart.md)
|
|
328
|
+
- [Core Concepts](docs/concepts.md)
|
|
329
|
+
- [Architecture](docs/architecture.md)
|
|
330
|
+
- [API Reference](docs/api_reference.md)
|
|
331
|
+
- [Vision](docs/vision.md)
|
|
332
|
+
- [Runtime](docs/runtime.md)
|
|
333
|
+
- [Security Model](docs/security_model.md)
|
|
334
|
+
- [Multi-Agent Runtime](docs/multi_agent.md)
|
|
335
|
+
- [Verification](docs/verification.md)
|
|
336
|
+
- [Observability](docs/observability.md)
|
|
337
|
+
|
|
338
|
+
## License
|
|
339
|
+
|
|
340
|
+
MIT License — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
[](https://www.python.org/downloads/)
|
|
2
|
+
[](https://opensource.org/licenses/MIT)
|
|
3
|
+
[]()
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# InfraRely
|
|
8
|
+
|
|
9
|
+
**Reliable Agent Infrastructure — Production-grade AI agent framework with zero boilerplate.**
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Why InfraRely?
|
|
14
|
+
|
|
15
|
+
Most AI agents today are unreliable when they move from demos to production.
|
|
16
|
+
|
|
17
|
+
### Common Problems
|
|
18
|
+
- **Non-deterministic execution** — behavior changes between runs, making debugging and incident response difficult
|
|
19
|
+
- **Hallucination (tool + response)** — models invent tool names, parameters, outputs, or unsupported claims
|
|
20
|
+
- **Poor observability** — limited traces make it hard to explain failures and regressions
|
|
21
|
+
- **Fragile multi-agent coordination** — delegation and message passing break under real workload pressure
|
|
22
|
+
- **Weak trust and accountability** — decisions are hard to audit, attribute, and defend in production
|
|
23
|
+
- **Identity breakdown** — unclear agent identity/permissions lead to unsafe cross-agent actions
|
|
24
|
+
- **Memory problems** — stale, conflicting, or ungrounded memory corrupts downstream decisions
|
|
25
|
+
|
|
26
|
+
InfraRely addresses these failures with infrastructure-first primitives:
|
|
27
|
+
|
|
28
|
+
- **Deterministic execution contracts** — router-first control flow with frozen plans and explicit fallbacks
|
|
29
|
+
- **Capability graphs** — dependency-aware workflows that compile and execute predictably
|
|
30
|
+
- **Verification layers** — structural, logical, knowledge, and policy checks on every result
|
|
31
|
+
- **Multi-agent runtime** — scheduler, message bus, shared memory, isolation, and deadlock-aware coordination
|
|
32
|
+
- **Identity and memory controls** — runtime identity/permissions plus scoped memory discipline for safer coordination
|
|
33
|
+
|
|
34
|
+
The result is an AI agent framework designed for reliability, auditability, and safe production deployment.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import infrarely
|
|
42
|
+
|
|
43
|
+
infrarely.configure(llm_provider="openai", api_key="sk-...")
|
|
44
|
+
|
|
45
|
+
agent = infrarely.agent("helper")
|
|
46
|
+
result = agent.run("What is 2+2?")
|
|
47
|
+
print(result.output) # 4 (no LLM call — deterministic math)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install infrarely
|
|
54
|
+
|
|
55
|
+
# With LLM provider extras:
|
|
56
|
+
pip install infrarely[openai]
|
|
57
|
+
pip install infrarely[anthropic]
|
|
58
|
+
pip install infrarely[all-providers]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
### Core Framework
|
|
66
|
+
- **3-line start** — `import infrarely` → `agent()` → `run()`
|
|
67
|
+
- **Errors-as-data** — `Result` objects with `.error`, never bare exceptions
|
|
68
|
+
- **LLM-as-last-resort** — Knowledge → Math → Tools → Capabilities → LLM
|
|
69
|
+
- **Observable by default** — traces, metrics, health checks on every agent
|
|
70
|
+
|
|
71
|
+
### 7-Layer Architecture
|
|
72
|
+
|
|
73
|
+
| Layer | Name | Description |
|
|
74
|
+
|-------|------|-------------|
|
|
75
|
+
| 1 | **Execution Contracts** | Deterministic routing, frozen execution plans, three-gate LLM isolation |
|
|
76
|
+
| 2 | **Capability Graphs** | Multi-step workflows with dependency resolution |
|
|
77
|
+
| 3 | **Infrastructure** | Execution depth guard, permissions, tool validation, sandboxing |
|
|
78
|
+
| 4 | **Verification** | Structural/logical/knowledge/policy checks on every result |
|
|
79
|
+
| 5 | **Adaptive Intelligence** | Self-optimizing routing, failure analysis, token optimization |
|
|
80
|
+
| 6 | **Multi-Agent Runtime** | OS-like kernel — scheduler, IPC, shared memory, RBAC, deadlock detection |
|
|
81
|
+
| 7 | **Autonomous Evolution** | Performance analysis, A/B testing, architecture proposals with policy guards |
|
|
82
|
+
|
|
83
|
+
### Tools & Knowledge
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
@infrarely.tool
|
|
87
|
+
def weather(city: str) -> str:
|
|
88
|
+
return f"Sunny in {city}"
|
|
89
|
+
|
|
90
|
+
agent = infrarely.agent("bot", tools=[weather])
|
|
91
|
+
result = agent.run("Weather in NYC?")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
agent = infrarely.agent("tutor")
|
|
96
|
+
agent.knowledge.add_documents("./notes/")
|
|
97
|
+
result = agent.run("Explain photosynthesis")
|
|
98
|
+
# LLM bypassed if knowledge confidence >= 85%
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Multi-Agent
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
researcher = infrarely.agent("researcher")
|
|
105
|
+
writer = infrarely.agent("writer")
|
|
106
|
+
facts = researcher.run("Find facts about Mars")
|
|
107
|
+
article = writer.run("Write article", context=facts)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Workflows (DAG)
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
wf = infrarely.workflow("pipeline", steps=[
|
|
114
|
+
infrarely.step("fetch", fetch_data),
|
|
115
|
+
infrarely.step("process", process, depends_on=["fetch"]),
|
|
116
|
+
infrarely.step("report", generate_report, depends_on=["process"]),
|
|
117
|
+
])
|
|
118
|
+
results = wf.execute()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Streaming
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
for chunk in agent.stream("Write a poem"):
|
|
125
|
+
print(chunk.text, end="", flush=True)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Security
|
|
129
|
+
|
|
130
|
+
- Prompt injection defense (7 injection types)
|
|
131
|
+
- Input sanitization (always-on)
|
|
132
|
+
- API key rotation
|
|
133
|
+
- Tool execution sandboxing
|
|
134
|
+
- Compliance audit logging
|
|
135
|
+
|
|
136
|
+
### Human-in-the-Loop
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
agent.require_approval_for("send_email", auto_approve_after=300)
|
|
140
|
+
result = agent.run("Send welcome email")
|
|
141
|
+
# Pauses for human approval
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### CLI
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
infrarely run "What is 2+2?"
|
|
148
|
+
infrarely health
|
|
149
|
+
infrarely metrics
|
|
150
|
+
infrarely deploy
|
|
151
|
+
infrarely verify
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## InfraRely Architecture
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Applications
|
|
160
|
+
│
|
|
161
|
+
│
|
|
162
|
+
AI Agents Layer
|
|
163
|
+
(Custom Agents Built by Developers)
|
|
164
|
+
│
|
|
165
|
+
│
|
|
166
|
+
InfraRely Agent Control Plane
|
|
167
|
+
┌─────────────────────────────────────────┐
|
|
168
|
+
│ │
|
|
169
|
+
│ Agent Pipeline │
|
|
170
|
+
│ • Planning Engine │
|
|
171
|
+
│ • Capability Graph │
|
|
172
|
+
│ • Tool Router │
|
|
173
|
+
│ • Verification Layer │
|
|
174
|
+
│ │
|
|
175
|
+
│ Platform Services │
|
|
176
|
+
│ • Memory System │
|
|
177
|
+
│ • Knowledge Engine │
|
|
178
|
+
│ • Workflow DAG Engine │
|
|
179
|
+
│ • Capability Registry │
|
|
180
|
+
│ │
|
|
181
|
+
│ Reliability Systems │
|
|
182
|
+
│ • Retry & Circuit Breakers │
|
|
183
|
+
│ • Token Optimization │
|
|
184
|
+
│ • Failure Recovery │
|
|
185
|
+
│ • Self-Healing Execution │
|
|
186
|
+
│ │
|
|
187
|
+
│ Observability │
|
|
188
|
+
│ • Execution Traces │
|
|
189
|
+
│ • Metrics & Telemetry │
|
|
190
|
+
│ • Token Budget Monitoring │
|
|
191
|
+
│ │
|
|
192
|
+
│ Security │
|
|
193
|
+
│ • Input Sanitization │
|
|
194
|
+
│ • Tool Sandbox │
|
|
195
|
+
│ • Permission Policies │
|
|
196
|
+
│ • Compliance Logging │
|
|
197
|
+
└─────────────────────────────────────────┘
|
|
198
|
+
│
|
|
199
|
+
│
|
|
200
|
+
InfraRely Runtime
|
|
201
|
+
(Scheduling, Isolation, State, Scaling)
|
|
202
|
+
│
|
|
203
|
+
│
|
|
204
|
+
External Systems / APIs
|
|
205
|
+
Databases • SaaS APIs • Filesystems • LLM Providers
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Architecture
|
|
209
|
+
|
|
210
|
+
InfraRely is structured as a layered **Agent Operating System**.
|
|
211
|
+
|
|
212
|
+
1. **Applications**
|
|
213
|
+
- Developer-built AI applications.
|
|
214
|
+
|
|
215
|
+
2. **Agents**
|
|
216
|
+
- Logical workers that execute tasks and coordinate tools.
|
|
217
|
+
|
|
218
|
+
3. **InfraRely Control Plane**
|
|
219
|
+
- Planning, routing, verification, and reliability systems.
|
|
220
|
+
|
|
221
|
+
4. **Runtime**
|
|
222
|
+
- Execution environment responsible for scheduling, isolation, and scalability.
|
|
223
|
+
|
|
224
|
+
5. **External Systems**
|
|
225
|
+
- APIs, databases, and LLM providers used by agents.
|
|
226
|
+
|
|
227
|
+
### Project Structure
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
infrarely/
|
|
231
|
+
├── core/ # Agent, Result, Config, Events, Decorators, Streaming
|
|
232
|
+
├── runtime/ # Workflow DAG, async runner, sandbox, scaling, multi-agent kernel
|
|
233
|
+
├── router/ # Rule-based intent classification, tool routing
|
|
234
|
+
├── agent/ # Execution pipeline, state machine, planning, verification
|
|
235
|
+
├── memory/ # Agent memory, knowledge engine, working/structured/long-term
|
|
236
|
+
├── security/ # Prompt injection defense, compliance, input sanitization
|
|
237
|
+
├── observability/ # Metrics, traces, logging, dashboard
|
|
238
|
+
├── optimization/ # Self-optimizing routing, failure analysis, token optimization
|
|
239
|
+
├── learning/ # A/B testing, architecture proposals, policy guards
|
|
240
|
+
├── platform/ # HITL, evaluation, versioning, marketplace, multitenancy, ACP
|
|
241
|
+
├── tools/ # Tool base classes, registry
|
|
242
|
+
├── capabilities/ # Multi-step capability definitions
|
|
243
|
+
├── integrations/ # GitHub, Gmail, Slack, Postgres, Notion, Webhooks, REST
|
|
244
|
+
├── internal/ # Execution engine bridges (private)
|
|
245
|
+
└── cli/ # CLI interface
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## LLM Providers
|
|
249
|
+
|
|
250
|
+
| Provider | Model | Setup |
|
|
251
|
+
|----------|-------|-------|
|
|
252
|
+
| OpenAI | gpt-4o, gpt-4o-mini | `infrarely.configure(llm_provider="openai", api_key="sk-...")` |
|
|
253
|
+
| Anthropic | claude-sonnet-4-20250514 | `infrarely.configure(llm_provider="anthropic", api_key="...")` |
|
|
254
|
+
| Groq | llama-3.1-8b-instant | `infrarely.configure(llm_provider="groq", api_key="...")` |
|
|
255
|
+
| Google Gemini | gemini-1.5-flash | `infrarely.configure(llm_provider="gemini", api_key="...")` |
|
|
256
|
+
| Ollama | llama3.2 (local) | `infrarely.configure(llm_provider="ollama")` |
|
|
257
|
+
|
|
258
|
+
## Configuration
|
|
259
|
+
|
|
260
|
+
```python
|
|
261
|
+
infrarely.configure(
|
|
262
|
+
llm_provider="openai",
|
|
263
|
+
api_key="sk-...",
|
|
264
|
+
llm_model="gpt-4o",
|
|
265
|
+
knowledge_threshold=0.85,
|
|
266
|
+
token_budget=10_000,
|
|
267
|
+
log_level="INFO",
|
|
268
|
+
max_agents=50,
|
|
269
|
+
)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Or via environment variables:
|
|
273
|
+
```bash
|
|
274
|
+
export INFRARELY_LLM_PROVIDER=openai
|
|
275
|
+
export INFRARELY_API_KEY=sk-...
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Documentation
|
|
279
|
+
|
|
280
|
+
- [Quickstart](docs/quickstart.md)
|
|
281
|
+
- [Core Concepts](docs/concepts.md)
|
|
282
|
+
- [Architecture](docs/architecture.md)
|
|
283
|
+
- [API Reference](docs/api_reference.md)
|
|
284
|
+
- [Vision](docs/vision.md)
|
|
285
|
+
- [Runtime](docs/runtime.md)
|
|
286
|
+
- [Security Model](docs/security_model.md)
|
|
287
|
+
- [Multi-Agent Runtime](docs/multi_agent.md)
|
|
288
|
+
- [Verification](docs/verification.md)
|
|
289
|
+
- [Observability](docs/observability.md)
|
|
290
|
+
|
|
291
|
+
## License
|
|
292
|
+
|
|
293
|
+
MIT License — see [LICENSE](LICENSE) for details.
|