sypho-sdk 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.
Files changed (38) hide show
  1. sypho_sdk-0.1.0/PKG-INFO +189 -0
  2. sypho_sdk-0.1.0/README.md +165 -0
  3. sypho_sdk-0.1.0/pyproject.toml +46 -0
  4. sypho_sdk-0.1.0/setup.cfg +4 -0
  5. sypho_sdk-0.1.0/sypho_sdk/__init__.py +58 -0
  6. sypho_sdk-0.1.0/sypho_sdk/agent/agent.py +80 -0
  7. sypho_sdk-0.1.0/sypho_sdk/agent/agent_context.py +242 -0
  8. sypho_sdk-0.1.0/sypho_sdk/discovery.py +120 -0
  9. sypho_sdk-0.1.0/sypho_sdk/entrypoint.py +38 -0
  10. sypho_sdk-0.1.0/sypho_sdk/langchain/langchain_adapter.py +11 -0
  11. sypho_sdk-0.1.0/sypho_sdk/langchain/langchain_utils.py +11 -0
  12. sypho_sdk-0.1.0/sypho_sdk/local_tools/__init__.py +0 -0
  13. sypho_sdk-0.1.0/sypho_sdk/local_tools/_artifact_client.py +72 -0
  14. sypho_sdk-0.1.0/sypho_sdk/local_tools/_live_session.py +406 -0
  15. sypho_sdk-0.1.0/sypho_sdk/local_tools/artifact_tools.py +63 -0
  16. sypho_sdk-0.1.0/sypho_sdk/local_tools/assets/dictation_probe.wav +0 -0
  17. sypho_sdk-0.1.0/sypho_sdk/local_tools/assets/sample_upload.png +0 -0
  18. sypho_sdk-0.1.0/sypho_sdk/local_tools/assets/sample_upload.txt +2 -0
  19. sypho_sdk-0.1.0/sypho_sdk/local_tools/blocking_tools.py +122 -0
  20. sypho_sdk-0.1.0/sypho_sdk/local_tools/browser_tools.py +1545 -0
  21. sypho_sdk-0.1.0/sypho_sdk/local_tools/dlp_tools.py +263 -0
  22. sypho_sdk-0.1.0/sypho_sdk/local_tools/git_tools.py +181 -0
  23. sypho_sdk-0.1.0/sypho_sdk/local_tools/orchestration_tools.py +62 -0
  24. sypho_sdk-0.1.0/sypho_sdk/local_tools/skill_tools.py +62 -0
  25. sypho_sdk-0.1.0/sypho_sdk/local_tools/structured_data_tools.py +135 -0
  26. sypho_sdk-0.1.0/sypho_sdk/local_tools/sub_run_tools.py +106 -0
  27. sypho_sdk-0.1.0/sypho_sdk/local_tools/teach_tools.py +314 -0
  28. sypho_sdk-0.1.0/sypho_sdk/manifest/manifest_types.py +55 -0
  29. sypho_sdk-0.1.0/sypho_sdk/manifest/manifest_utils.py +40 -0
  30. sypho_sdk-0.1.0/sypho_sdk/model/control_plane_adapter.py +119 -0
  31. sypho_sdk-0.1.0/sypho_sdk/model/model_adapter.py +56 -0
  32. sypho_sdk-0.1.0/sypho_sdk/runtime.py +321 -0
  33. sypho_sdk-0.1.0/sypho_sdk/tool.py +57 -0
  34. sypho_sdk-0.1.0/sypho_sdk.egg-info/PKG-INFO +189 -0
  35. sypho_sdk-0.1.0/sypho_sdk.egg-info/SOURCES.txt +36 -0
  36. sypho_sdk-0.1.0/sypho_sdk.egg-info/dependency_links.txt +1 -0
  37. sypho_sdk-0.1.0/sypho_sdk.egg-info/requires.txt +5 -0
  38. sypho_sdk-0.1.0/sypho_sdk.egg-info/top_level.txt +1 -0
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: sypho-sdk
3
+ Version: 0.1.0
4
+ Summary: Python SDK for building and deploying Sypho agents
5
+ Author-email: Sypho <hello@sypho.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://sypho.ai
8
+ Project-URL: Documentation, https://docs.sypho.ai
9
+ Project-URL: Repository, https://github.com/sypho/sypho-sdk
10
+ Keywords: agent,ai,automation,sdk,sypho
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: click>=8.3.1
20
+ Requires-Dist: langchain>=1.2.13
21
+ Requires-Dist: pyyaml>=6.0.3
22
+ Requires-Dist: requests>=2.32.5
23
+ Requires-Dist: python-socketio[asyncio-client]>=5.11.0
24
+
25
+ # Sypho SDK
26
+
27
+ Python SDK for building and deploying AI agents on the Sypho platform.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install sypho-sdk
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ ### 1. Define an Agent with Entrypoints
38
+
39
+ ```python
40
+ from sypho_sdk import entrypoint, tool, AgentContext
41
+
42
+ @entrypoint(name="search", description="Search for information")
43
+ async def search_handler(input: dict, context: AgentContext):
44
+ query = input["query"]
45
+
46
+ # Call tools
47
+ results = await context.call_tool("web_search", {"query": query})
48
+
49
+ return {"results": results}
50
+
51
+ @tool(name="web_search", description="Search the web")
52
+ def web_search(query: str) -> dict:
53
+ # Your search implementation
54
+ return {"results": [...]}
55
+ ```
56
+
57
+ ### 2. Auto-Discovery
58
+
59
+ The SDK automatically discovers all `@entrypoint` and `@tool` decorated functions when packaging your agent:
60
+
61
+ ```bash
62
+ python -m sypho_sdk.auto_package my_agent.main my-agent 0.1.0
63
+ ```
64
+
65
+ This generates a complete manifest with all entrypoints and tools automatically discovered.
66
+
67
+ ### 3. Local Development
68
+
69
+ ```python
70
+ from sypho_sdk import Agent
71
+
72
+ # Traditional agent definition (also supported)
73
+ agent = Agent("my-agent")
74
+
75
+ @agent.task
76
+ async def run(input: dict, context):
77
+ # Agent logic
78
+ return {"output": "result"}
79
+ ```
80
+
81
+ ## Features
82
+
83
+ - **@entrypoint decorator**: Mark functions as agent entry points
84
+ - **@tool decorator**: Define reusable tools with automatic schema generation
85
+ - **Auto-discovery**: Automatically generate manifests from decorated functions
86
+ - **Agent Context**: Built-in context for tool calls, LLM interactions, and state management
87
+ - **Local tools**: Mark tools as local with `@tool(local=True)`
88
+ - **Type hints**: Automatic parameter schema generation from Python type hints
89
+
90
+ ## API Reference
91
+
92
+ ### Decorators
93
+
94
+ #### `@entrypoint(name=None, description=None)`
95
+
96
+ Marks a function as an agent entrypoint. Entrypoints are the main execution paths for your agent.
97
+
98
+ ```python
99
+ @entrypoint(name="main", description="Main entry point")
100
+ async def main_handler(input: dict, context: AgentContext):
101
+ return {"result": "success"}
102
+ ```
103
+
104
+ #### `@tool(name=None, description=None, parameters=None, local=False)`
105
+
106
+ Defines a tool that can be called by the agent.
107
+
108
+ ```python
109
+ @tool(name="calculate", description="Perform calculations")
110
+ def calculate(a: int, b: int, operation: str = "add") -> int:
111
+ if operation == "add":
112
+ return a + b
113
+ elif operation == "multiply":
114
+ return a * b
115
+ ```
116
+
117
+ ### Classes
118
+
119
+ #### `AgentContext`
120
+
121
+ Provides methods for interacting with the platform during agent execution:
122
+
123
+ - `await context.call_tool(name, args)`: Call a tool
124
+ - `await context.chat(messages, tools)`: Interact with LLM
125
+ - `context.run_loop()`: Start agentic execution loop
126
+
127
+ #### `Agent`
128
+
129
+ Traditional agent definition class (backwards compatible):
130
+
131
+ ```python
132
+ agent = Agent("agent-name")
133
+
134
+ @agent.task
135
+ async def run(input, context):
136
+ return {"output": "result"}
137
+ ```
138
+
139
+ ## Examples
140
+
141
+ ### Multi-Entrypoint Agent
142
+
143
+ ```python
144
+ from sypho_sdk import entrypoint, tool, AgentContext
145
+
146
+ @entrypoint(name="analyze", description="Analyze data")
147
+ async def analyze(input: dict, context: AgentContext):
148
+ data = input["data"]
149
+ analysis = await context.call_tool("process_data", {"data": data})
150
+ return {"analysis": analysis}
151
+
152
+ @entrypoint(name="report", description="Generate report")
153
+ async def report(input: dict, context: AgentContext):
154
+ analysis_result = input["analysis_result"]
155
+ report = await context.call_tool("format_report", analysis_result)
156
+ return {"report": report}
157
+
158
+ @tool(name="process_data")
159
+ def process_data(data: list) -> dict:
160
+ return {"processed": len(data)}
161
+
162
+ @tool(name="format_report")
163
+ def format_report(data: dict) -> str:
164
+ return f"Analysis Report: {data}"
165
+ ```
166
+
167
+ ## Development
168
+
169
+ ### Building the Package
170
+
171
+ ```bash
172
+ python -m build
173
+ ```
174
+
175
+ ### Installing Locally
176
+
177
+ ```bash
178
+ pip install -e .
179
+ ```
180
+
181
+ ## License
182
+
183
+ MIT
184
+
185
+ ## Support
186
+
187
+ - Documentation: https://docs.sypho.ai
188
+ - GitHub: https://github.com/sypho/sypho-sdk
189
+ - Website: https://sypho.ai
@@ -0,0 +1,165 @@
1
+ # Sypho SDK
2
+
3
+ Python SDK for building and deploying AI agents on the Sypho platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install sypho-sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### 1. Define an Agent with Entrypoints
14
+
15
+ ```python
16
+ from sypho_sdk import entrypoint, tool, AgentContext
17
+
18
+ @entrypoint(name="search", description="Search for information")
19
+ async def search_handler(input: dict, context: AgentContext):
20
+ query = input["query"]
21
+
22
+ # Call tools
23
+ results = await context.call_tool("web_search", {"query": query})
24
+
25
+ return {"results": results}
26
+
27
+ @tool(name="web_search", description="Search the web")
28
+ def web_search(query: str) -> dict:
29
+ # Your search implementation
30
+ return {"results": [...]}
31
+ ```
32
+
33
+ ### 2. Auto-Discovery
34
+
35
+ The SDK automatically discovers all `@entrypoint` and `@tool` decorated functions when packaging your agent:
36
+
37
+ ```bash
38
+ python -m sypho_sdk.auto_package my_agent.main my-agent 0.1.0
39
+ ```
40
+
41
+ This generates a complete manifest with all entrypoints and tools automatically discovered.
42
+
43
+ ### 3. Local Development
44
+
45
+ ```python
46
+ from sypho_sdk import Agent
47
+
48
+ # Traditional agent definition (also supported)
49
+ agent = Agent("my-agent")
50
+
51
+ @agent.task
52
+ async def run(input: dict, context):
53
+ # Agent logic
54
+ return {"output": "result"}
55
+ ```
56
+
57
+ ## Features
58
+
59
+ - **@entrypoint decorator**: Mark functions as agent entry points
60
+ - **@tool decorator**: Define reusable tools with automatic schema generation
61
+ - **Auto-discovery**: Automatically generate manifests from decorated functions
62
+ - **Agent Context**: Built-in context for tool calls, LLM interactions, and state management
63
+ - **Local tools**: Mark tools as local with `@tool(local=True)`
64
+ - **Type hints**: Automatic parameter schema generation from Python type hints
65
+
66
+ ## API Reference
67
+
68
+ ### Decorators
69
+
70
+ #### `@entrypoint(name=None, description=None)`
71
+
72
+ Marks a function as an agent entrypoint. Entrypoints are the main execution paths for your agent.
73
+
74
+ ```python
75
+ @entrypoint(name="main", description="Main entry point")
76
+ async def main_handler(input: dict, context: AgentContext):
77
+ return {"result": "success"}
78
+ ```
79
+
80
+ #### `@tool(name=None, description=None, parameters=None, local=False)`
81
+
82
+ Defines a tool that can be called by the agent.
83
+
84
+ ```python
85
+ @tool(name="calculate", description="Perform calculations")
86
+ def calculate(a: int, b: int, operation: str = "add") -> int:
87
+ if operation == "add":
88
+ return a + b
89
+ elif operation == "multiply":
90
+ return a * b
91
+ ```
92
+
93
+ ### Classes
94
+
95
+ #### `AgentContext`
96
+
97
+ Provides methods for interacting with the platform during agent execution:
98
+
99
+ - `await context.call_tool(name, args)`: Call a tool
100
+ - `await context.chat(messages, tools)`: Interact with LLM
101
+ - `context.run_loop()`: Start agentic execution loop
102
+
103
+ #### `Agent`
104
+
105
+ Traditional agent definition class (backwards compatible):
106
+
107
+ ```python
108
+ agent = Agent("agent-name")
109
+
110
+ @agent.task
111
+ async def run(input, context):
112
+ return {"output": "result"}
113
+ ```
114
+
115
+ ## Examples
116
+
117
+ ### Multi-Entrypoint Agent
118
+
119
+ ```python
120
+ from sypho_sdk import entrypoint, tool, AgentContext
121
+
122
+ @entrypoint(name="analyze", description="Analyze data")
123
+ async def analyze(input: dict, context: AgentContext):
124
+ data = input["data"]
125
+ analysis = await context.call_tool("process_data", {"data": data})
126
+ return {"analysis": analysis}
127
+
128
+ @entrypoint(name="report", description="Generate report")
129
+ async def report(input: dict, context: AgentContext):
130
+ analysis_result = input["analysis_result"]
131
+ report = await context.call_tool("format_report", analysis_result)
132
+ return {"report": report}
133
+
134
+ @tool(name="process_data")
135
+ def process_data(data: list) -> dict:
136
+ return {"processed": len(data)}
137
+
138
+ @tool(name="format_report")
139
+ def format_report(data: dict) -> str:
140
+ return f"Analysis Report: {data}"
141
+ ```
142
+
143
+ ## Development
144
+
145
+ ### Building the Package
146
+
147
+ ```bash
148
+ python -m build
149
+ ```
150
+
151
+ ### Installing Locally
152
+
153
+ ```bash
154
+ pip install -e .
155
+ ```
156
+
157
+ ## License
158
+
159
+ MIT
160
+
161
+ ## Support
162
+
163
+ - Documentation: https://docs.sypho.ai
164
+ - GitHub: https://github.com/sypho/sypho-sdk
165
+ - Website: https://sypho.ai
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sypho-sdk"
7
+ version = "0.1.0"
8
+ description = "Python SDK for building and deploying Sypho agents"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Sypho", email = "hello@sypho.ai"}
14
+ ]
15
+ keywords = ["agent", "ai", "automation", "sdk", "sypho"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ ]
24
+ dependencies = [
25
+ "click>=8.3.1",
26
+ "langchain>=1.2.13",
27
+ "pyyaml>=6.0.3",
28
+ "requests>=2.32.5",
29
+ "python-socketio[asyncio-client]>=5.11.0",
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://sypho.ai"
34
+ Documentation = "https://docs.sypho.ai"
35
+ Repository = "https://github.com/sypho/sypho-sdk"
36
+
37
+ [tool.setuptools.packages.find]
38
+ include = ["sypho_sdk*"]
39
+
40
+ [tool.setuptools.package-data]
41
+ # Ship non-Python data files or `pip install .` drops them (the base image installs
42
+ # the SDK this way). local_tools/assets holds the bundled sample upload files and the
43
+ # fake-mic WAV — without these, set_files() for uploads and dictation audio fail with
44
+ # FileNotFoundError inside the container.
45
+ sypho_sdk = ["py.typed"]
46
+ "sypho_sdk.local_tools" = ["assets/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,58 @@
1
+ """
2
+ Sypho SDK - Python library for building and deploying AI agents.
3
+
4
+ Usage:
5
+ from sypho_sdk import entrypoint, tool, AgentContext, Agent
6
+
7
+ @entrypoint(name="main", description="Main entry point")
8
+ async def main_handler(input: dict, context: AgentContext):
9
+ result = await context.call_tool("my_tool", {"arg": "value"})
10
+ return {"result": result}
11
+
12
+ @tool(name="my_tool", description="A custom tool")
13
+ def my_tool(arg: str) -> dict:
14
+ return {"processed": arg}
15
+ """
16
+
17
+ __version__ = "0.1.0"
18
+
19
+ # Core decorators
20
+ from .entrypoint import entrypoint
21
+ from .tool import tool
22
+
23
+ # Agent classes
24
+ from .agent.agent import Agent
25
+ from .agent.agent_context import AgentContext
26
+
27
+ # Discovery utilities
28
+ from .discovery import discover_entrypoints, discover_tools, scan_module_tree
29
+
30
+ # Manifest types (for advanced users)
31
+ from .manifest.manifest_types import (
32
+ AgentManifest,
33
+ EntrypointManifest,
34
+ ToolManifest,
35
+ AgentModeConfig,
36
+ ExecutionMode,
37
+ )
38
+
39
+ __all__ = [
40
+ # Version
41
+ "__version__",
42
+ # Decorators
43
+ "entrypoint",
44
+ "tool",
45
+ # Classes
46
+ "Agent",
47
+ "AgentContext",
48
+ # Discovery
49
+ "discover_entrypoints",
50
+ "discover_tools",
51
+ "scan_module_tree",
52
+ # Types
53
+ "AgentManifest",
54
+ "EntrypointManifest",
55
+ "ToolManifest",
56
+ "AgentModeConfig",
57
+ "ExecutionMode",
58
+ ]
@@ -0,0 +1,80 @@
1
+ from sypho_sdk.manifest.manifest_types import AgentManifest, AgentModeConfig, ExecutionMode, SkillManifest
2
+
3
+
4
+ class Agent:
5
+ def __init__(
6
+ self,
7
+ name: str,
8
+ tools=None,
9
+ skills: list[SkillManifest] | None = None,
10
+ execution_mode: ExecutionMode = "worker",
11
+ agent_config: AgentModeConfig | None = None,
12
+ allowed_sub_agents: list[str] | None = None,
13
+ structured_data_dependencies: dict | None = None,
14
+ ):
15
+ self.name = name
16
+ self.tools = list(tools or [])
17
+ self.skills = skills or []
18
+ self.execution_mode = execution_mode
19
+ self.agent_config = agent_config
20
+ self.allowed_sub_agents = allowed_sub_agents or []
21
+ self.structured_data_dependencies = structured_data_dependencies
22
+ self._task = None
23
+
24
+ if execution_mode == "agent" and not agent_config:
25
+ raise ValueError("agent_config is required when execution_mode is 'agent'")
26
+
27
+ if self.allowed_sub_agents:
28
+ from sypho_sdk.local_tools.sub_run_tools import make_spawn_sub_run_tool
29
+
30
+ self.tools.append(make_spawn_sub_run_tool(self.allowed_sub_agents))
31
+
32
+ def task(self, fn):
33
+ self._task = fn
34
+ return fn
35
+
36
+ async def run(self, input_data, ctx):
37
+ if not self._task:
38
+ raise RuntimeError("No task registered")
39
+ return await self._task(input_data, ctx)
40
+
41
+ def manifest_for_entrypoint(self, entrypoint: str, version: str = "0.1.0") -> AgentManifest:
42
+ local_tool_names = [
43
+ t._tool_name for t in self.tools if getattr(t, '_is_local_tool', False)
44
+ ]
45
+
46
+ entrypoint_manifest = {
47
+ "tools": [
48
+ {
49
+ "name": t._tool_name,
50
+ "description": t._tool_description,
51
+ "parameters": t._tool_parameters,
52
+ }
53
+ for t in self.tools
54
+ ]
55
+ }
56
+
57
+ if local_tool_names:
58
+ entrypoint_manifest["local_tools"] = local_tool_names
59
+
60
+ if self.skills:
61
+ entrypoint_manifest["skills"] = self.skills
62
+
63
+ if self.allowed_sub_agents:
64
+ entrypoint_manifest["allowed_sub_agents"] = self.allowed_sub_agents
65
+
66
+ manifest: AgentManifest = {
67
+ "schema_version": "1.0",
68
+ "agent_name": self.name,
69
+ "version": version,
70
+ "execution_mode": self.execution_mode,
71
+ "entrypoints": {entrypoint: entrypoint_manifest},
72
+ }
73
+
74
+ if self.execution_mode == "agent" and self.agent_config:
75
+ manifest["agent_config"] = self.agent_config
76
+
77
+ if self.structured_data_dependencies:
78
+ manifest["structured_data_dependencies"] = self.structured_data_dependencies
79
+
80
+ return manifest