Types & Exceptions¶
Enums¶
AutonomyLevel ¶
Severity ¶
TraceLevel ¶
Exception Hierarchy¶
AgenticAPIError ¶
Harness Exceptions¶
HarnessError ¶
Bases: AgenticAPIError
Base exception for harness engine errors.
PolicyViolation ¶
Bases: HarnessError
Policy violation. Generated code does not conform to policy.
Source code in src/agenticapi/exceptions.py
SandboxViolation ¶
Bases: HarnessError
Sandbox violation. Forbidden operation detected at runtime.
ApprovalRequired ¶
Bases: HarnessError
Approval required. Human approval is needed to continue.
Source code in src/agenticapi/exceptions.py
ApprovalDenied ¶
Bases: HarnessError
Approval was denied.
ApprovalTimeout ¶
Bases: HarnessError
Approval timed out.
Runtime Exceptions¶
AgentRuntimeError ¶
Bases: AgenticAPIError
Base exception for agent runtime errors.
CodeGenerationError ¶
Bases: AgentRuntimeError
Code generation failed.
CodeExecutionError ¶
Bases: AgentRuntimeError
Generated code execution failed.
ToolError ¶
Bases: AgentRuntimeError
Tool invocation failed.
ContextError ¶
Bases: AgentRuntimeError
Context construction failed.
Interface Exceptions¶
InterfaceError ¶
Bases: AgenticAPIError
Base exception for interface layer errors.
IntentParseError ¶
Bases: InterfaceError
Intent parsing failed.
SessionError ¶
Bases: InterfaceError
Session management error.
A2AError ¶
Bases: InterfaceError
Agent-to-Agent communication error.
AuthenticationError ¶
Bases: InterfaceError
Authentication failed or credentials missing.
AuthorizationError ¶
Bases: InterfaceError
Authenticated user lacks required permissions.
HTTP Status Mapping¶
| Exception | HTTP Status |
|---|---|
IntentParseError |
400 Bad Request |
SessionError |
400 Bad Request |
AuthenticationError |
401 Unauthorized |
PolicyViolation |
403 Forbidden |
ApprovalDenied |
403 Forbidden |
SandboxViolation |
403 Forbidden |
AuthorizationError |
403 Forbidden |
ApprovalRequired |
202 Accepted |
ApprovalTimeout |
408 Request Timeout |
CodeGenerationError |
500 Internal Server Error |
CodeExecutionError |
500 Internal Server Error |
ToolError |
502 Bad Gateway |
A2AError |
502 Bad Gateway |
Dependency Injection¶
HarnessDepends ¶
Dependency injection marker for harness components.
Analogous to FastAPI's Depends(). Marks a parameter as requiring injection of a harness-related dependency at runtime.
Example
@app.agent_endpoint(name="users") async def user_agent( intent: Intent, context: AgentContext, harness: HarnessEngine = HarnessDepends(get_harness), ): ...
Source code in src/agenticapi/params.py
__init__ ¶
Initialize the dependency marker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dependency
|
Callable[..., Any]
|
A callable that provides the dependency value. |
required |