Observed since 20 Oct, 23:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A production-ready Python framework for building autonomous AI agents that can plan, validate, and execute complex tasks using LLMs and custom tools
A modular, production-ready Python framework for building autonomous AI agents that can plan, validate, and execute complex tasks using LLMs and custom tools.
📦 Install: pip install agentv2 | 🔗 PyPI: pypi.org/project/agentv2
AgentV2 is a deterministic, production-grade agent framework that separates concerns into distinct components:
The framework enforces strict architectural boundaries, ensuring predictable execution, no silent failures, and deterministic outcomes.
Install from PyPI (Recommended):
pip install agentv2
📦 Package: agentv2 on PyPI
Or install from source (Development):
# Clone the repository
git clone <repository-url>
cd AgentV2
# Install in editable mode
pip install -e .
# Or install with development dependencies
pip install -e ".[dev]"
Create a .env file:
API_KEY=your_api_key_here
from agentv2.src.agent import Agent
import uuid
# Define tools
def add(a: int, b: int) -> int:
return a + b
tools = {"add": add}
# Create agent
agent = Agent(
model="groq/openai/gpt-oss-120b",
system_prompt="You are an autonomous execution agent.",
session_id=f"session-{uuid.uuid4().hex[:8]}",
tools=tools,
)
# Run a task
result = agent.run("Add 5 and 10, then multiply by 2")
print(result.final_reply)
from agentv2.src.agent import Agent
from ddgs import DDGS
import uuid
def web_search(query: str) -> str:
with DDGS() as ddgs:
results = list(ddgs.text(query, max_results=5))
return format_results(results)
tools = {"web_search": web_search}
agent = Agent(
model="groq/openai/gpt-oss-120b",
system_prompt="You are a helpful assistant with web search.",
session_id=f"chat-{uuid.uuid4().hex[:8]}",
tools=tools,
)
# Use chat API (with session memory)
reply = agent.chat("What's the latest news about AI?")
print(reply)
from agentv2.src.agent import Agent
from pathlib import Path
import uuid
def read_file(path: str) -> str:
return Path(path).read_text()
def write_file(path: str, content: str) -> str:
Path(path).write_text(content)
return f"Wrote {len(content)} bytes to {path}"
tools = {
"read_file": read_file,
"write_file": write_file,
}
agent = Agent(
model="groq/openai/gpt-oss-120b",
system_prompt="You are a file operations agent.",
session_id=f"fileops-{uuid.uuid4().hex[:8]}",
tools=tools,
domain_validator=None, # Disable domain validation for file ops
)
result = agent.run("Create a hello.py file that prints 'Hello, World!'")
print(result.final_reply)
The framework enforces strict boundaries:
AgentState schemaAgentV2/
├── src/
│ ├── agent.py # High-level orchestrator
│ ├── planner.py # Todo generation
│ ├── executor.py # Deterministic execution
│ └── session_store.py # Session memory management
├── schemas/
│ ├── AgentMemory.py # Authoritative memory state
│ ├── AgentState.py # LLM action proposals
│ ├── TodoSchema.py # Todo data models
│ └── SessionMemory.py # Session context model
├── utils/
│ ├── llm.py # LLM interface (LiteLLM)
│ ├── logger.py # Rich logging utilities
│ ├── validators.py # Todo validation & scoring
│ └── Prompts.py # Prompt template loader
├── prompts/
│ ├── Agent.md # Execution prompt
│ ├── Todo.md # Planning prompt
│ ├── FinalReply.md # Summarization prompt
│ └── TodoRewrite.md # Rewrite prompt
├── main.py # Example: Basic tools
├── main2.py # Example: Chat agent
├── main3.py # Example: File operations
└── README.md
def my_custom_tool(param1: str, param2: int) -> str:
"""Tool description for the LLM."""
# Your logic here
return "result"
tools = {
"my_custom_tool": my_custom_tool,
}
from agentv2.utils.validators import DomainTodoValidator
class MyDomainValidator(DomainTodoValidator):
FORBIDDEN = ["forbidden_term1", "forbidden_term2"]
def validate(self, todo: TodoItemInput) -> None:
# Your validation logic
pass
agent = Agent(
...,
domain_validator=MyDomainValidator(),
)
Edit the markdown files in prompts/:
Agent.md - Execution instructionsTodo.md - Planning instructionsFinalReply.md - Summarization instructionsTodoListInput using LLMTodoList with UUIDsAgentState (think/tool/complete_todo/fail_todo/noop)AgentMemory (authoritative state)The framework uses Rich for beautiful, structured logging:
logs/ directorygraph TD
A[User Task] --> B[Agent.run]
B --> C[Planner]
C --> D[Generate Todos]
D --> E[Validator]
E --> F{Valid?}
F -->|No| G[Auto-Rewrite]
G --> E
F -->|Yes| H[Executor]
H --> I[Execute Todos]
I --> J[LLM Proposes Action]
J --> K{Action Type}
K -->|tool| L[Execute Tool]
K -->|complete_todo| M[Mark Complete]
K -->|think| N[Update State]
L --> O[Update Memory]
M --> O
N --> O
O --> P{All Done?}
P -->|No| I
P -->|Yes| Q[Summarize]
Q --> R[Final Reply]
graph LR
subgraph "Agent (Orchestrator)"
A1[Task Input] --> A2[Plan]
A2 --> A3[Validate]
A3 --> A4[Execute]
A4 --> A5[Summarize]
end
subgraph "Planner"
P1[Task] --> P2[LLM Generate]
P2 --> P3[TodoList]
end
subgraph "Validator"
V1[TodoList] --> V2[Base Rules]
V2 --> V3[Domain Rules]
V3 --> V4[Quality Score]
V4 --> V5{Pass?}
V5 -->|No| V6[Rewrite]
V6 --> V1
V5 -->|Yes| V7[Validated]
end
subgraph "Executor"
E1[TodoList] --> E2[Iterate Todos]
E2 --> E3[LLM Action]
E3 --> E4{Action}
E4 -->|tool| E5[Call Tool]
E4 -->|complete| E6[Mark Done]
E4 -->|think| E7[Update State]
E5 --> E8[Update Memory]
E6 --> E8
E7 --> E8
E8 --> E9{Next?}
E9 -->|Yes| E2
E9 -->|No| E10[Done]
end
A2 --> P1
A3 --> V1
A4 --> E1
V7 --> A4
E10 --> A5
sequenceDiagram
participant U as User
participant A as Agent
participant S as SessionStore
participant C as Cache
U->>A: chat("What's the weather?")
A->>S: get(session_id)
S->>C: check_cache(normalized_task)
alt Cache Hit
C-->>A: cached_reply
A-->>U: cached_reply (no LLM call)
else Cache Miss
A->>A: plan + execute
A->>C: cache_reply(task, reply)
A-->>U: final_reply
end
This is a production-ready framework with strict architectural constraints. When contributing:
This project is licensed under the MIT License - see the LICENSE file for details.
Made With Hate and Love Because perfection isn't born out of love, it's forged in frustration, obsession, and an unrelenting pursuit of something better.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.4 | 25 Jan 2026 | 13 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 23:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:f9d014db856865d07589b48a3d263b68412817b2f754786396518f582a285320