mtpx 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.
- mtp/__init__.py +132 -0
- mtp/agent.py +1986 -0
- mtp/config.py +29 -0
- mtp/events.py +22 -0
- mtp/exceptions.py +10 -0
- mtp/mcp.py +306 -0
- mtp/media.py +268 -0
- mtp/policy.py +32 -0
- mtp/prompts.py +7 -0
- mtp/protocol.py +77 -0
- mtp/providers/__init__.py +40 -0
- mtp/providers/anthropic_provider.py +328 -0
- mtp/providers/cerebras_provider.py +200 -0
- mtp/providers/cohere_provider.py +334 -0
- mtp/providers/common.py +375 -0
- mtp/providers/deepseek_provider.py +224 -0
- mtp/providers/fireworks_provider.py +247 -0
- mtp/providers/gemini_provider.py +437 -0
- mtp/providers/groq_provider.py +336 -0
- mtp/providers/mistral_provider.py +208 -0
- mtp/providers/mock.py +6 -0
- mtp/providers/openai_provider.py +164 -0
- mtp/providers/openrouter_provider.py +335 -0
- mtp/providers/sambanova_provider.py +164 -0
- mtp/providers/simple_planner.py +55 -0
- mtp/providers/together_provider.py +225 -0
- mtp/runtime.py +404 -0
- mtp/schema.py +182 -0
- mtp/session_store.py +463 -0
- mtp/simple_agent.py +948 -0
- mtp/strict.py +90 -0
- mtp/toolkits/__init__.py +23 -0
- mtp/toolkits/calculator.py +98 -0
- mtp/toolkits/common.py +16 -0
- mtp/toolkits/crawl4ai_toolkit.py +115 -0
- mtp/toolkits/file_toolkit.py +135 -0
- mtp/toolkits/local.py +22 -0
- mtp/toolkits/newspaper4k_toolkit.py +77 -0
- mtp/toolkits/newspaper_toolkit.py +42 -0
- mtp/toolkits/python_toolkit.py +130 -0
- mtp/toolkits/shell_toolkit.py +70 -0
- mtp/toolkits/website_toolkit.py +69 -0
- mtp/toolkits/wikipedia_toolkit.py +48 -0
- mtp/tools.py +159 -0
- mtp/transport/__init__.py +4 -0
- mtp/transport/http.py +52 -0
- mtp/transport/stdio.py +29 -0
- mtpx-0.1.0.dist-info/METADATA +163 -0
- mtpx-0.1.0.dist-info/RECORD +51 -0
- mtpx-0.1.0.dist-info/WHEEL +5 -0
- mtpx-0.1.0.dist-info/top_level.txt +1 -0
mtp/__init__.py
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
from .events import EventStreamContext
|
|
2
|
+
from .config import load_dotenv_if_available
|
|
3
|
+
from .policy import PolicyDecision, RiskPolicy
|
|
4
|
+
from .agent import Agent, AgentAction, ProviderAdapter, RunOutput
|
|
5
|
+
from .session_store import (
|
|
6
|
+
JsonSessionStore,
|
|
7
|
+
MySQLSessionStore,
|
|
8
|
+
PostgresSessionStore,
|
|
9
|
+
SessionRecord,
|
|
10
|
+
SessionRun,
|
|
11
|
+
SessionStore,
|
|
12
|
+
)
|
|
13
|
+
from .exceptions import RetryAgentRun, StopAgentRun
|
|
14
|
+
from .protocol import (
|
|
15
|
+
ExecutionPlan,
|
|
16
|
+
ToolOutput,
|
|
17
|
+
ToolBatch,
|
|
18
|
+
ToolCall,
|
|
19
|
+
ToolResult,
|
|
20
|
+
ToolRiskLevel,
|
|
21
|
+
ToolSpec,
|
|
22
|
+
)
|
|
23
|
+
from .media import Audio, File, Image, Video
|
|
24
|
+
from .runtime import ExecutionCancelledError, ToolRegistry, ToolkitLoader, ToolRetryError, ToolStopError
|
|
25
|
+
from .schema import (
|
|
26
|
+
CURRENT_MTP_VERSION,
|
|
27
|
+
MessageEnvelope,
|
|
28
|
+
ToolArgumentsValidationError,
|
|
29
|
+
validate_execution_plan,
|
|
30
|
+
validate_tool_arguments,
|
|
31
|
+
)
|
|
32
|
+
from .simple_agent import MTPAgent
|
|
33
|
+
from .strict import StrictViolation, validate_strict_dependencies
|
|
34
|
+
from .tools import FunctionToolkit, mtp_tool, tool_spec_from_callable, toolkit_from_functions
|
|
35
|
+
from .toolkits import (
|
|
36
|
+
CalculatorToolkit,
|
|
37
|
+
Crawl4aiToolkit,
|
|
38
|
+
FileToolkit,
|
|
39
|
+
Newspaper4kToolkit,
|
|
40
|
+
NewspaperToolkit,
|
|
41
|
+
PythonToolkit,
|
|
42
|
+
ShellToolkit,
|
|
43
|
+
WebsiteToolkit,
|
|
44
|
+
WikipediaToolkit,
|
|
45
|
+
register_local_toolkits,
|
|
46
|
+
)
|
|
47
|
+
from .transport import HTTPTransportServer, run_stdio_transport
|
|
48
|
+
from .mcp import MCPJsonRpcServer, MCPServerInfo, run_mcp_stdio
|
|
49
|
+
|
|
50
|
+
# Convenience aliases for minimal import style:
|
|
51
|
+
# from mtp import Agent
|
|
52
|
+
# tools = Agent.ToolRegistry()
|
|
53
|
+
# helper = Agent.MTPAgent(...)
|
|
54
|
+
Agent.MTPAgent = MTPAgent
|
|
55
|
+
Agent.ToolRegistry = ToolRegistry
|
|
56
|
+
Agent.ToolkitLoader = ToolkitLoader
|
|
57
|
+
Agent.ToolSpec = ToolSpec
|
|
58
|
+
Agent.ToolRiskLevel = ToolRiskLevel
|
|
59
|
+
Agent.Audio = Audio
|
|
60
|
+
Agent.Image = Image
|
|
61
|
+
Agent.Video = Video
|
|
62
|
+
Agent.File = File
|
|
63
|
+
Agent.mtp_tool = staticmethod(mtp_tool)
|
|
64
|
+
Agent.tool_spec_from_callable = staticmethod(tool_spec_from_callable)
|
|
65
|
+
Agent.FunctionToolkit = FunctionToolkit
|
|
66
|
+
Agent.toolkit_from_functions = staticmethod(toolkit_from_functions)
|
|
67
|
+
Agent.RetryAgentRun = RetryAgentRun
|
|
68
|
+
Agent.StopAgentRun = StopAgentRun
|
|
69
|
+
Agent.register_local_toolkits = staticmethod(register_local_toolkits)
|
|
70
|
+
Agent.load_dotenv_if_available = staticmethod(load_dotenv_if_available)
|
|
71
|
+
|
|
72
|
+
__all__ = [
|
|
73
|
+
"Agent",
|
|
74
|
+
"AgentAction",
|
|
75
|
+
"RunOutput",
|
|
76
|
+
"SessionStore",
|
|
77
|
+
"JsonSessionStore",
|
|
78
|
+
"PostgresSessionStore",
|
|
79
|
+
"MySQLSessionStore",
|
|
80
|
+
"SessionRecord",
|
|
81
|
+
"SessionRun",
|
|
82
|
+
"ExecutionPlan",
|
|
83
|
+
"CURRENT_MTP_VERSION",
|
|
84
|
+
"MTPAgent",
|
|
85
|
+
"EventStreamContext",
|
|
86
|
+
"mtp_tool",
|
|
87
|
+
"tool_spec_from_callable",
|
|
88
|
+
"FunctionToolkit",
|
|
89
|
+
"toolkit_from_functions",
|
|
90
|
+
"MessageEnvelope",
|
|
91
|
+
"ProviderAdapter",
|
|
92
|
+
"PolicyDecision",
|
|
93
|
+
"RiskPolicy",
|
|
94
|
+
"ToolBatch",
|
|
95
|
+
"ToolCall",
|
|
96
|
+
"ToolOutput",
|
|
97
|
+
"ToolRegistry",
|
|
98
|
+
"ExecutionCancelledError",
|
|
99
|
+
"ToolRetryError",
|
|
100
|
+
"ToolStopError",
|
|
101
|
+
"ToolResult",
|
|
102
|
+
"ToolRiskLevel",
|
|
103
|
+
"ToolSpec",
|
|
104
|
+
"Audio",
|
|
105
|
+
"Image",
|
|
106
|
+
"Video",
|
|
107
|
+
"File",
|
|
108
|
+
"ToolkitLoader",
|
|
109
|
+
"CalculatorToolkit",
|
|
110
|
+
"Crawl4aiToolkit",
|
|
111
|
+
"FileToolkit",
|
|
112
|
+
"NewspaperToolkit",
|
|
113
|
+
"Newspaper4kToolkit",
|
|
114
|
+
"PythonToolkit",
|
|
115
|
+
"ShellToolkit",
|
|
116
|
+
"WebsiteToolkit",
|
|
117
|
+
"WikipediaToolkit",
|
|
118
|
+
"register_local_toolkits",
|
|
119
|
+
"HTTPTransportServer",
|
|
120
|
+
"run_stdio_transport",
|
|
121
|
+
"MCPJsonRpcServer",
|
|
122
|
+
"MCPServerInfo",
|
|
123
|
+
"run_mcp_stdio",
|
|
124
|
+
"StrictViolation",
|
|
125
|
+
"validate_strict_dependencies",
|
|
126
|
+
"load_dotenv_if_available",
|
|
127
|
+
"validate_execution_plan",
|
|
128
|
+
"validate_tool_arguments",
|
|
129
|
+
"ToolArgumentsValidationError",
|
|
130
|
+
"RetryAgentRun",
|
|
131
|
+
"StopAgentRun",
|
|
132
|
+
]
|