voxagent 0.1.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.
- voxagent/__init__.py +143 -0
- voxagent/_version.py +5 -0
- voxagent/agent/__init__.py +32 -0
- voxagent/agent/abort.py +178 -0
- voxagent/agent/core.py +902 -0
- voxagent/code/__init__.py +9 -0
- voxagent/mcp/__init__.py +16 -0
- voxagent/mcp/manager.py +188 -0
- voxagent/mcp/tool.py +152 -0
- voxagent/providers/__init__.py +110 -0
- voxagent/providers/anthropic.py +498 -0
- voxagent/providers/augment.py +293 -0
- voxagent/providers/auth.py +116 -0
- voxagent/providers/base.py +268 -0
- voxagent/providers/chatgpt.py +415 -0
- voxagent/providers/claudecode.py +162 -0
- voxagent/providers/cli_base.py +265 -0
- voxagent/providers/codex.py +183 -0
- voxagent/providers/failover.py +90 -0
- voxagent/providers/google.py +532 -0
- voxagent/providers/groq.py +96 -0
- voxagent/providers/ollama.py +425 -0
- voxagent/providers/openai.py +435 -0
- voxagent/providers/registry.py +175 -0
- voxagent/py.typed +1 -0
- voxagent/security/__init__.py +14 -0
- voxagent/security/events.py +75 -0
- voxagent/security/filter.py +169 -0
- voxagent/security/registry.py +87 -0
- voxagent/session/__init__.py +39 -0
- voxagent/session/compaction.py +237 -0
- voxagent/session/lock.py +103 -0
- voxagent/session/model.py +109 -0
- voxagent/session/storage.py +184 -0
- voxagent/streaming/__init__.py +52 -0
- voxagent/streaming/emitter.py +286 -0
- voxagent/streaming/events.py +255 -0
- voxagent/subagent/__init__.py +20 -0
- voxagent/subagent/context.py +124 -0
- voxagent/subagent/definition.py +172 -0
- voxagent/tools/__init__.py +32 -0
- voxagent/tools/context.py +50 -0
- voxagent/tools/decorator.py +175 -0
- voxagent/tools/definition.py +131 -0
- voxagent/tools/executor.py +109 -0
- voxagent/tools/policy.py +89 -0
- voxagent/tools/registry.py +89 -0
- voxagent/types/__init__.py +46 -0
- voxagent/types/messages.py +134 -0
- voxagent/types/run.py +176 -0
- voxagent-0.1.0.dist-info/METADATA +186 -0
- voxagent-0.1.0.dist-info/RECORD +53 -0
- voxagent-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"""Message types for voxagent.
|
|
2
|
+
|
|
3
|
+
This module defines the core message types used in agent conversations:
|
|
4
|
+
- ContentBlock types (TextBlock, ImageBlock, ToolUseBlock, ToolResultBlock)
|
|
5
|
+
- ToolCall and ToolResult for tool interactions
|
|
6
|
+
- Message for conversation messages
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Annotated, Any, Literal, Union
|
|
10
|
+
|
|
11
|
+
from pydantic import BaseModel, Field
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TextBlock(BaseModel):
|
|
15
|
+
"""A text content block.
|
|
16
|
+
|
|
17
|
+
Attributes:
|
|
18
|
+
type: Discriminator field, always "text".
|
|
19
|
+
text: The text content.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
type: Literal["text"] = "text"
|
|
23
|
+
text: str
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ImageBlock(BaseModel):
|
|
27
|
+
"""An image content block with base64-encoded data.
|
|
28
|
+
|
|
29
|
+
Attributes:
|
|
30
|
+
type: Discriminator field, always "image".
|
|
31
|
+
media_type: The MIME type of the image (e.g., "image/png", "image/jpeg").
|
|
32
|
+
data: Base64-encoded image data.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
type: Literal["image"] = "image"
|
|
36
|
+
media_type: str
|
|
37
|
+
data: str
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ToolUseBlock(BaseModel):
|
|
41
|
+
"""A tool use block representing a tool call in assistant content.
|
|
42
|
+
|
|
43
|
+
Attributes:
|
|
44
|
+
type: Discriminator field, always "tool_use".
|
|
45
|
+
id: Unique identifier for this tool use.
|
|
46
|
+
name: Name of the tool to call.
|
|
47
|
+
input: Dictionary of input parameters for the tool.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
type: Literal["tool_use"] = "tool_use"
|
|
51
|
+
id: str
|
|
52
|
+
name: str
|
|
53
|
+
input: dict[str, Any] = Field(default_factory=dict)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class ToolResultBlock(BaseModel):
|
|
57
|
+
"""A tool result block representing a tool's output in user content.
|
|
58
|
+
|
|
59
|
+
Attributes:
|
|
60
|
+
type: Discriminator field, always "tool_result".
|
|
61
|
+
tool_use_id: The ID of the corresponding ToolUseBlock.
|
|
62
|
+
tool_name: Optional name of the tool (for providers that need it).
|
|
63
|
+
content: The result content from the tool.
|
|
64
|
+
is_error: Whether the result represents an error.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
type: Literal["tool_result"] = "tool_result"
|
|
68
|
+
tool_use_id: str
|
|
69
|
+
tool_name: str | None = None
|
|
70
|
+
content: str
|
|
71
|
+
is_error: bool = False
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# ContentBlock is a discriminated union of all content block types
|
|
75
|
+
# Using Pydantic's discriminator for robust JSON parsing
|
|
76
|
+
ContentBlock = Annotated[
|
|
77
|
+
Union[TextBlock, ImageBlock, ToolUseBlock, ToolResultBlock],
|
|
78
|
+
Field(discriminator="type"),
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class ToolCall(BaseModel):
|
|
83
|
+
"""A tool call request.
|
|
84
|
+
|
|
85
|
+
Attributes:
|
|
86
|
+
id: Unique identifier for this tool call.
|
|
87
|
+
name: Name of the tool to call.
|
|
88
|
+
params: Dictionary of parameters for the tool.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
id: str
|
|
92
|
+
name: str
|
|
93
|
+
params: dict[str, Any] = Field(default_factory=dict)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class ToolResult(BaseModel):
|
|
97
|
+
"""Result from a tool execution.
|
|
98
|
+
|
|
99
|
+
Attributes:
|
|
100
|
+
tool_use_id: The ID of the corresponding ToolCall.
|
|
101
|
+
content: The result content from the tool.
|
|
102
|
+
is_error: Whether the result represents an error.
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
tool_use_id: str
|
|
106
|
+
content: str
|
|
107
|
+
is_error: bool = False
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class Message(BaseModel):
|
|
111
|
+
"""A message in a conversation.
|
|
112
|
+
|
|
113
|
+
Attributes:
|
|
114
|
+
role: The role of the message sender ("user", "assistant", or "system").
|
|
115
|
+
content: The message content, either a string or a list of ContentBlocks.
|
|
116
|
+
tool_calls: Optional list of tool calls (only for assistant messages).
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
role: Literal["user", "assistant", "system"]
|
|
120
|
+
content: str | list[ContentBlock]
|
|
121
|
+
tool_calls: list[ToolCall] | None = None
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
__all__ = [
|
|
125
|
+
"ContentBlock",
|
|
126
|
+
"ImageBlock",
|
|
127
|
+
"Message",
|
|
128
|
+
"TextBlock",
|
|
129
|
+
"ToolCall",
|
|
130
|
+
"ToolResult",
|
|
131
|
+
"ToolResultBlock",
|
|
132
|
+
"ToolUseBlock",
|
|
133
|
+
]
|
|
134
|
+
|
voxagent/types/run.py
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""Run parameters and result types for voxagent.
|
|
2
|
+
|
|
3
|
+
This module defines the types used for agent run configuration and results:
|
|
4
|
+
- ModelConfig for model provider and settings
|
|
5
|
+
- AgentConfig for agent behavior settings
|
|
6
|
+
- ToolPolicy for tool access control
|
|
7
|
+
- RunParams for run configuration
|
|
8
|
+
- ToolMeta for tool execution metadata
|
|
9
|
+
- RunResult for run outcome
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from pydantic import BaseModel, Field, field_validator
|
|
16
|
+
|
|
17
|
+
from .messages import Message
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ModelConfig(BaseModel):
|
|
21
|
+
"""Configuration for the model to use.
|
|
22
|
+
|
|
23
|
+
Attributes:
|
|
24
|
+
provider: The model provider (e.g., "anthropic", "openai", "ollama").
|
|
25
|
+
model: The model name (e.g., "claude-3-5-sonnet", "gpt-4o").
|
|
26
|
+
temperature: Optional sampling temperature.
|
|
27
|
+
max_tokens: Optional maximum tokens for generation.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
provider: str
|
|
31
|
+
model: str
|
|
32
|
+
temperature: float | None = None
|
|
33
|
+
max_tokens: int | None = None
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_string(cls, model_string: str) -> "ModelConfig":
|
|
37
|
+
"""Parse a model string in 'provider:model' format.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
model_string: String in format "provider:model"
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
ModelConfig instance
|
|
44
|
+
|
|
45
|
+
Raises:
|
|
46
|
+
ValueError: If the string doesn't contain a colon separator
|
|
47
|
+
"""
|
|
48
|
+
if ":" not in model_string:
|
|
49
|
+
raise ValueError(
|
|
50
|
+
f"Invalid model string format: '{model_string}'. Expected 'provider:model'"
|
|
51
|
+
)
|
|
52
|
+
provider, model = model_string.split(":", 1)
|
|
53
|
+
return cls(provider=provider, model=model)
|
|
54
|
+
|
|
55
|
+
def to_string(self) -> str:
|
|
56
|
+
"""Convert to 'provider:model' string format.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
String in format "provider:model"
|
|
60
|
+
"""
|
|
61
|
+
return f"{self.provider}:{self.model}"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class AgentConfig(BaseModel):
|
|
65
|
+
"""Configuration for agent behavior.
|
|
66
|
+
|
|
67
|
+
Attributes:
|
|
68
|
+
max_turns: Maximum number of conversation turns. Default 50.
|
|
69
|
+
context_limit: Maximum context size in tokens. Default 100000.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
max_turns: int = 50
|
|
73
|
+
context_limit: int = 100000
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ToolPolicy(BaseModel):
|
|
77
|
+
"""Policy for controlling tool access.
|
|
78
|
+
|
|
79
|
+
Attributes:
|
|
80
|
+
allow_list: List of allowed tool names. None means allow all.
|
|
81
|
+
deny_list: List of denied tool names. Defaults to empty.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
allow_list: list[str] | None = None
|
|
85
|
+
deny_list: list[str] = Field(default_factory=list)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class RunParams(BaseModel):
|
|
89
|
+
"""Parameters for an agent run.
|
|
90
|
+
|
|
91
|
+
Attributes:
|
|
92
|
+
session_key: Unique session identifier (required, non-empty).
|
|
93
|
+
prompt: The user prompt to process (required).
|
|
94
|
+
model: Model configuration (required).
|
|
95
|
+
config: Agent configuration (required).
|
|
96
|
+
timeout_ms: Timeout in milliseconds (required, must be > 0).
|
|
97
|
+
workspace_dir: Working directory for the agent (required).
|
|
98
|
+
abort_signal: Optional signal for aborting the run.
|
|
99
|
+
channel: Optional channel identifier.
|
|
100
|
+
policies: List of tool policies to apply. Defaults to empty.
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
session_key: str
|
|
104
|
+
prompt: str
|
|
105
|
+
model: ModelConfig
|
|
106
|
+
config: AgentConfig
|
|
107
|
+
timeout_ms: int
|
|
108
|
+
workspace_dir: Path
|
|
109
|
+
abort_signal: Any | None = None
|
|
110
|
+
channel: str | None = None
|
|
111
|
+
policies: list[ToolPolicy] = Field(default_factory=list)
|
|
112
|
+
|
|
113
|
+
@field_validator("session_key")
|
|
114
|
+
@classmethod
|
|
115
|
+
def session_key_must_not_be_empty(cls, v: str) -> str:
|
|
116
|
+
"""Validate that session_key is not empty."""
|
|
117
|
+
if not v:
|
|
118
|
+
raise ValueError("session_key must not be empty")
|
|
119
|
+
return v
|
|
120
|
+
|
|
121
|
+
@field_validator("timeout_ms")
|
|
122
|
+
@classmethod
|
|
123
|
+
def timeout_ms_must_be_positive(cls, v: int) -> int:
|
|
124
|
+
"""Validate that timeout_ms is positive."""
|
|
125
|
+
if v <= 0:
|
|
126
|
+
raise ValueError("timeout_ms must be positive")
|
|
127
|
+
return v
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class ToolMeta(BaseModel):
|
|
131
|
+
"""Metadata about a tool execution.
|
|
132
|
+
|
|
133
|
+
Attributes:
|
|
134
|
+
tool_name: Name of the tool that was called.
|
|
135
|
+
tool_call_id: Unique identifier for the tool call.
|
|
136
|
+
execution_time_ms: Time taken to execute in milliseconds.
|
|
137
|
+
success: Whether the execution was successful.
|
|
138
|
+
error: Error message if execution failed.
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
tool_name: str
|
|
142
|
+
tool_call_id: str
|
|
143
|
+
execution_time_ms: int = 0
|
|
144
|
+
success: bool = True
|
|
145
|
+
error: str | None = None
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class RunResult(BaseModel):
|
|
149
|
+
"""Result of an agent run.
|
|
150
|
+
|
|
151
|
+
Attributes:
|
|
152
|
+
messages: List of messages from the conversation.
|
|
153
|
+
assistant_texts: List of text responses from the assistant.
|
|
154
|
+
tool_metas: List of tool execution metadata.
|
|
155
|
+
aborted: Whether the run was aborted.
|
|
156
|
+
timed_out: Whether the run timed out.
|
|
157
|
+
error: Error message if the run failed.
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
messages: list[Message]
|
|
161
|
+
assistant_texts: list[str]
|
|
162
|
+
tool_metas: list[ToolMeta] = Field(default_factory=list)
|
|
163
|
+
aborted: bool = False
|
|
164
|
+
timed_out: bool = False
|
|
165
|
+
error: str | None = None
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
__all__ = [
|
|
169
|
+
"AgentConfig",
|
|
170
|
+
"ModelConfig",
|
|
171
|
+
"RunParams",
|
|
172
|
+
"RunResult",
|
|
173
|
+
"ToolMeta",
|
|
174
|
+
"ToolPolicy",
|
|
175
|
+
]
|
|
176
|
+
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voxagent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A lightweight, model-agnostic LLM provider abstraction with streaming and tool support
|
|
5
|
+
Project-URL: Homepage, https://github.com/lensator/voxagent
|
|
6
|
+
Project-URL: Documentation, https://github.com/lensator/voxagent#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/lensator/voxagent
|
|
8
|
+
Project-URL: Issues, https://github.com/lensator/voxagent/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/lensator/voxagent/blob/main/CHANGELOG.md
|
|
10
|
+
Author: voxDomus team
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
Keywords: agent,ai,anthropic,llm,mcp,openai,streaming,tools
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: anyio>=4.0
|
|
25
|
+
Requires-Dist: httpx>=0.25
|
|
26
|
+
Requires-Dist: pydantic>=2.0
|
|
27
|
+
Provides-Extra: all
|
|
28
|
+
Requires-Dist: anthropic>=0.25; extra == 'all'
|
|
29
|
+
Requires-Dist: google-generativeai>=0.5; extra == 'all'
|
|
30
|
+
Requires-Dist: groq>=0.4; extra == 'all'
|
|
31
|
+
Requires-Dist: mcp>=1.0; extra == 'all'
|
|
32
|
+
Requires-Dist: ollama>=0.2; extra == 'all'
|
|
33
|
+
Requires-Dist: openai>=1.0; extra == 'all'
|
|
34
|
+
Requires-Dist: tiktoken>=0.5; extra == 'all'
|
|
35
|
+
Provides-Extra: anthropic
|
|
36
|
+
Requires-Dist: anthropic>=0.25; extra == 'anthropic'
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
43
|
+
Provides-Extra: google
|
|
44
|
+
Requires-Dist: google-generativeai>=0.5; extra == 'google'
|
|
45
|
+
Provides-Extra: groq
|
|
46
|
+
Requires-Dist: groq>=0.4; extra == 'groq'
|
|
47
|
+
Provides-Extra: mcp
|
|
48
|
+
Requires-Dist: mcp>=1.0; extra == 'mcp'
|
|
49
|
+
Provides-Extra: ollama
|
|
50
|
+
Requires-Dist: ollama>=0.2; extra == 'ollama'
|
|
51
|
+
Provides-Extra: openai
|
|
52
|
+
Requires-Dist: openai>=1.0; extra == 'openai'
|
|
53
|
+
Requires-Dist: tiktoken>=0.5; extra == 'openai'
|
|
54
|
+
Description-Content-Type: text/markdown
|
|
55
|
+
|
|
56
|
+
# voxagent
|
|
57
|
+
|
|
58
|
+
[](https://badge.fury.io/py/voxagent)
|
|
59
|
+
[](https://www.python.org/downloads/)
|
|
60
|
+
[](https://opensource.org/licenses/MIT)
|
|
61
|
+
[](https://peps.python.org/pep-0561/)
|
|
62
|
+
|
|
63
|
+
A lightweight, model-agnostic LLM provider abstraction with streaming and tool support.
|
|
64
|
+
|
|
65
|
+
## Features
|
|
66
|
+
|
|
67
|
+
- **Multi-Provider**: Unified interface for OpenAI, Anthropic, Google, Groq, Ollama
|
|
68
|
+
- **Streaming**: Typed `StreamChunk` union (TextDelta, ToolUse, MessageEnd, Error)
|
|
69
|
+
- **Tool System**: `@tool` decorator for easy function-to-tool conversion
|
|
70
|
+
- **MCP Integration**: First-class Model Context Protocol support
|
|
71
|
+
- **Type Safe**: Full type hints with `py.typed` marker
|
|
72
|
+
- **Minimal Dependencies**: Core requires only `pydantic`, `httpx`, `anyio`
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Core only (no provider SDKs)
|
|
78
|
+
pip install voxagent
|
|
79
|
+
|
|
80
|
+
# With specific providers
|
|
81
|
+
pip install voxagent[openai]
|
|
82
|
+
pip install voxagent[anthropic]
|
|
83
|
+
pip install voxagent[google]
|
|
84
|
+
pip install voxagent[ollama]
|
|
85
|
+
|
|
86
|
+
# All providers
|
|
87
|
+
pip install voxagent[all]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Quick Start
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
import asyncio
|
|
94
|
+
from voxagent import Agent
|
|
95
|
+
|
|
96
|
+
async def main():
|
|
97
|
+
agent = Agent(model="openai:gpt-4o")
|
|
98
|
+
result = await agent.run("Hello, world!")
|
|
99
|
+
print(result.output)
|
|
100
|
+
|
|
101
|
+
asyncio.run(main())
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Streaming
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from voxagent import Agent
|
|
108
|
+
from voxagent.providers import TextDeltaChunk
|
|
109
|
+
|
|
110
|
+
agent = Agent(model="anthropic:claude-3-5-sonnet")
|
|
111
|
+
|
|
112
|
+
async for chunk in agent.stream("Tell me a story"):
|
|
113
|
+
if isinstance(chunk, TextDeltaChunk):
|
|
114
|
+
print(chunk.delta, end="", flush=True)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Tools
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from voxagent import Agent
|
|
121
|
+
from voxagent.tools import tool
|
|
122
|
+
|
|
123
|
+
@tool()
|
|
124
|
+
def get_weather(city: str) -> str:
|
|
125
|
+
"""Get the current weather for a city."""
|
|
126
|
+
return f"Sunny, 72°F in {city}"
|
|
127
|
+
|
|
128
|
+
agent = Agent(
|
|
129
|
+
model="openai:gpt-4o",
|
|
130
|
+
tools=[get_weather],
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
result = await agent.run("What's the weather in Paris?")
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Supported Providers
|
|
137
|
+
|
|
138
|
+
| Provider | Model Format | Example |
|
|
139
|
+
|----------|--------------|---------|
|
|
140
|
+
| OpenAI | `openai:model` | `openai:gpt-4o` |
|
|
141
|
+
| Anthropic | `anthropic:model` | `anthropic:claude-3-5-sonnet` |
|
|
142
|
+
| Google | `google:model` | `google:gemini-1.5-pro` |
|
|
143
|
+
| Groq | `groq:model` | `groq:llama-3.1-70b` |
|
|
144
|
+
| Ollama | `ollama:model` | `ollama:llama3.2` |
|
|
145
|
+
|
|
146
|
+
## API Reference
|
|
147
|
+
|
|
148
|
+
### Agent
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
from voxagent import Agent
|
|
152
|
+
|
|
153
|
+
agent = Agent(
|
|
154
|
+
model="provider:model", # Required: provider:model string
|
|
155
|
+
system_prompt="...", # Optional: system instructions
|
|
156
|
+
tools=[...], # Optional: list of tools
|
|
157
|
+
temperature=0.7, # Optional: sampling temperature
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
# Single response
|
|
161
|
+
result = await agent.run("prompt")
|
|
162
|
+
|
|
163
|
+
# Streaming
|
|
164
|
+
async for chunk in agent.stream("prompt"):
|
|
165
|
+
...
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### StreamChunk Types
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from voxagent.providers import (
|
|
172
|
+
TextDeltaChunk, # Text content
|
|
173
|
+
ToolUseChunk, # Tool invocation
|
|
174
|
+
MessageEndChunk, # End of message
|
|
175
|
+
ErrorChunk, # Error occurred
|
|
176
|
+
)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Contributing
|
|
180
|
+
|
|
181
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
186
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
voxagent/__init__.py,sha256=YMYC95iwWXK26hicGYmd2erNOInrYtohwUVOuNmpTCs,3927
|
|
2
|
+
voxagent/_version.py,sha256=UZNgW5i4fgEyRh_mbeD3SQyS6bLMfXkimp37vJd2Kso,129
|
|
3
|
+
voxagent/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
+
voxagent/agent/__init__.py,sha256=eASoU7Zhvw8BtJ-iUqVN06S4fMLkHwDgUZbHeH2AUOM,755
|
|
5
|
+
voxagent/agent/abort.py,sha256=2Wnnxq8Dcn7wQkKPHrba2o0OeOdzF4NNsl-usgE4CJw,5191
|
|
6
|
+
voxagent/agent/core.py,sha256=zXDUubx6oWQCj1V997s2zJ0Xj0XCaWIPZNinTNMz2zY,30581
|
|
7
|
+
voxagent/code/__init__.py,sha256=6-i-FjYxwNay7XvWt9kwwg2nk3wPNzRp54AtEBdQ13U,237
|
|
8
|
+
voxagent/mcp/__init__.py,sha256=_3Rsn7nIuivdWLv0MzpyjRGsPuCgr4LrXCge6FCb3nE,470
|
|
9
|
+
voxagent/mcp/manager.py,sha256=sECOhw-f6HB6NV-mBqcgJzsEt28acdQI_O2cT-41Rxw,6606
|
|
10
|
+
voxagent/mcp/tool.py,sha256=j_p5Kmra_g69vucohQRr0xguy6lXPFzwSAdX4OFsNK4,5113
|
|
11
|
+
voxagent/providers/__init__.py,sha256=lUmbIoiVFSX-CqfrVYiS5Rbriy_U061NR0vC4qChWR8,3202
|
|
12
|
+
voxagent/providers/anthropic.py,sha256=A9aJUBc2nwqFdtvh5CyHp0GSQR82DaxwJQsgA79cffg,15889
|
|
13
|
+
voxagent/providers/augment.py,sha256=K8ORZsOh88FBh4d7pYZUgMQHtQXnhJizpjwGkbWf53Y,8623
|
|
14
|
+
voxagent/providers/auth.py,sha256=X3yDSHzj7gP-XxiYVpTSpDZs608gxnd-0UYX5aNNsEw,3650
|
|
15
|
+
voxagent/providers/base.py,sha256=f_tPz4LFWX2nU9q1aa__Z3UpT35VpQnDVr40Z3VM6uk,6933
|
|
16
|
+
voxagent/providers/chatgpt.py,sha256=DBjoc8UTONxwz2BGhsPVevSJBlLduai4gjzt62_lZrE,15620
|
|
17
|
+
voxagent/providers/claudecode.py,sha256=4pUnWO9IJlXnagnqu3bl6SIDdyjpDohjOwJqRe96g6U,4331
|
|
18
|
+
voxagent/providers/cli_base.py,sha256=0N4psjsH9ekgfq6ynspPQ48iB5BmN6qiOSDPMHjJdBA,7554
|
|
19
|
+
voxagent/providers/codex.py,sha256=NUtCH1fqf1OTI2JEOlNClofm6spWq4ZvlaPaHbyotyE,5397
|
|
20
|
+
voxagent/providers/failover.py,sha256=fBwzD_iJ1bJ3W7kQzT0qoogTXg0G9NMbAucJOIT3R5k,2719
|
|
21
|
+
voxagent/providers/google.py,sha256=f8QdbZxqi6L5syzmYAOiCVnJwN0Bs1ym3nDNvCbQ8Fg,18239
|
|
22
|
+
voxagent/providers/groq.py,sha256=KEwscwKBJdft6ZST3nTEcodh06AxoAzTsDvIr7O-pzQ,2765
|
|
23
|
+
voxagent/providers/ollama.py,sha256=WKHgWMfo4cAFwKYxRe2m3sNOg91OlUL1Uo8MUH6hzuQ,13166
|
|
24
|
+
voxagent/providers/openai.py,sha256=bs8iwU0qy35obV1cjv6gCzsOKBR-BSrq8p5Z2oO_hmE,14475
|
|
25
|
+
voxagent/providers/registry.py,sha256=kcHBlbveiVufJTDxUQ65GBVm5qJdxycsXioWJ2SJeTI,5441
|
|
26
|
+
voxagent/security/__init__.py,sha256=EF3Z30AMQNCOoyjsa8QNG6EA4uSyKv54exkM-5HYylE,361
|
|
27
|
+
voxagent/security/events.py,sha256=9yb0PC9iX8MZC53I-nNcKE_4iQRdCB2FE4lvDxgJT18,2123
|
|
28
|
+
voxagent/security/filter.py,sha256=d-ZbZi2MrwJB8ulY_lBXxFfS_YY-W-kcapRvvdLNEp4,4932
|
|
29
|
+
voxagent/security/registry.py,sha256=Nt2s92o0UPTbgoxHzwfb5HU6U0R-nbf6oZdgGIC66FY,2657
|
|
30
|
+
voxagent/session/__init__.py,sha256=OCwAh0UM-yv6BPFVIGKVkB_tuMW_Ixs5K8P7fIKx9u8,981
|
|
31
|
+
voxagent/session/compaction.py,sha256=8ksRKPkYpF6S2jO3lsVqkrLpDmc2SxRGSQWmf2A_yhg,7560
|
|
32
|
+
voxagent/session/lock.py,sha256=5T1Lymf4A9B1s9TvwFCjUgG6zaNzi7d5HC_rbdImc8Y,3294
|
|
33
|
+
voxagent/session/model.py,sha256=MkdbwMmvT5PFiCJZl0arW2uC64SPcAOuWIDEIwf2M-k,3592
|
|
34
|
+
voxagent/session/storage.py,sha256=ma0UWbOeVeIdYcfzMwGtw1QGSoosdY1NPo2lKd-x7ms,5829
|
|
35
|
+
voxagent/streaming/__init__.py,sha256=gMiAnqVB24Y9KwkgolkMTtySyD8XnBe4Iva6szCPWXc,1092
|
|
36
|
+
voxagent/streaming/emitter.py,sha256=GEAzkbFjG7KZcCYUY5YRdBb0sU5eVw3NevVcEC9W9Sw,9513
|
|
37
|
+
voxagent/streaming/events.py,sha256=unWh38vxSiDoXU02x3e-TM0tclNsPR7JsH5YrkIFb_g,6996
|
|
38
|
+
voxagent/subagent/__init__.py,sha256=sH7Z6wqWJiR1SSvC1z20XizwWKFWIkUs4KwJTvwr0rc,487
|
|
39
|
+
voxagent/subagent/context.py,sha256=2JCzHxavVASkeTfS99Q6tzPamT3moLgHM9MFWfFs7m8,4117
|
|
40
|
+
voxagent/subagent/definition.py,sha256=pbBvuUdUjfCeFbTASGhd_ljceADHy9hL2iEuMxDtHlk,5803
|
|
41
|
+
voxagent/tools/__init__.py,sha256=JJ66f_fjwdcVmLwyp3B0sQA1RVPZN0PdS-SJPMU2nGU,867
|
|
42
|
+
voxagent/tools/context.py,sha256=0DWC2QF-1vWMmst-4IoEtAovzE-g1f8hhmboQpXWH1w,1343
|
|
43
|
+
voxagent/tools/decorator.py,sha256=fQj2kOcCeVRZ21XbrZ9TDBx6OOFZ-waxDoLNsGc7z-o,5030
|
|
44
|
+
voxagent/tools/definition.py,sha256=OfYwO402gDGbbRjjcr0dJTWsEBOQLkhJmdIIiVSHA6A,4113
|
|
45
|
+
voxagent/tools/executor.py,sha256=fK3DlS9c3ROVx2ixbAiAn-0e13GYBe6jOyHqze3AJig,2678
|
|
46
|
+
voxagent/tools/policy.py,sha256=mCdYYnITrVTg9w5bwiCMOiXknrU1SQza_qZo02juQdg,2496
|
|
47
|
+
voxagent/tools/registry.py,sha256=MNJzgcmKT0AoMWIky9TJY4WVhzn5dkmjIHsUiZ3mv3U,2593
|
|
48
|
+
voxagent/types/__init__.py,sha256=3VunuprKKEpOR9Cg-UITHJXds_xQ-tfqQb4S7wD3nP4,933
|
|
49
|
+
voxagent/types/messages.py,sha256=c6hNi9w6C8gbFoFm5fFge35vwJGywaoR_OiPQprfyVs,3494
|
|
50
|
+
voxagent/types/run.py,sha256=4vYq0pCqH7_7SWbMb1SplWj4TLiE3DELDYMi0HefFmo,5071
|
|
51
|
+
voxagent-0.1.0.dist-info/METADATA,sha256=2Rx_AsdBcjXYytjFNIR03hZ-53mN3Nz-rntojpKAVcc,5610
|
|
52
|
+
voxagent-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
53
|
+
voxagent-0.1.0.dist-info/RECORD,,
|