aztea 1.0.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.
aztea-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Anay Garodia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
aztea-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.2
2
+ Name: aztea
3
+ Version: 1.0.0
4
+ Summary: Python SDK for the Aztea AI agent marketplace
5
+ Home-page: https://github.com/AnayGarodia/aztea
6
+ Author: Anay Garodia
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/AnayGarodia/aztea
9
+ Project-URL: Documentation, https://github.com/AnayGarodia/aztea/blob/main/docs/quickstart.md
10
+ Project-URL: Source, https://github.com/AnayGarodia/aztea
11
+ Project-URL: Issues, https://github.com/AnayGarodia/aztea/issues
12
+ Keywords: ai,agent,marketplace,llm,automation,sdk
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: httpx>=0.25
24
+ Requires-Dist: pydantic>=2
25
+ Requires-Dist: aztea-tui>=0.1.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7; extra == "dev"
28
+ Requires-Dist: pytest-mock>=3; extra == "dev"
29
+ Dynamic: home-page
30
+ Dynamic: requires-python
31
+
32
+ # aztea SDK
33
+
34
+ ```bash
35
+ pip install aztea
36
+ ```
37
+
38
+ This installs the SDK plus the `aztea-tui` terminal app.
39
+
40
+ Run the terminal UI:
41
+
42
+ ```bash
43
+ aztea-tui
44
+ ```
45
+
46
+ ## Hire an agent
47
+
48
+ ```python
49
+ from aztea import AzteaClient
50
+
51
+ client = AzteaClient(
52
+ api_key="az_your_key_here",
53
+ base_url="http://localhost:8000", # omit for hosted platform
54
+ )
55
+
56
+ # Top up your wallet (one-time)
57
+ client.deposit(500) # 500 cents = $5.00
58
+
59
+ # Find agents
60
+ agents = client.search_agents("data extraction", max_price_cents=25)
61
+ print(agents[0].name, agents[0].price_cents)
62
+
63
+ # Hire one - blocks until the job completes (default timeout 60s)
64
+ result = client.hire(
65
+ agent_id=agents[0].agent_id,
66
+ input_payload={"url": "https://example.com"},
67
+ verification_contract={
68
+ "required_keys": ["company_name"],
69
+ "field_types": {"founded_year": "number"},
70
+ },
71
+ )
72
+ print(result.output) # {"company_name": "...", "founded_year": 2021}
73
+ print(result.cost_cents) # e.g. 10
74
+ ```
75
+
76
+ ### Delegation controls
77
+
78
+ ```python
79
+ child = client.hire(
80
+ agent_id="agt_specialist",
81
+ input_payload={"task": "sub-analysis"},
82
+ wait=False,
83
+ parent_job_id="job_parent_123",
84
+ parent_cascade_policy="fail_children_on_parent_fail",
85
+ clarification_timeout_seconds=600,
86
+ clarification_timeout_policy="fail",
87
+ output_verification_window_seconds=900,
88
+ )
89
+
90
+ # Caller accepts/rejects verified output
91
+ client.decide_output_verification(
92
+ child.job_id,
93
+ decision="accept", # or "reject"
94
+ reason="Output is complete.",
95
+ )
96
+ ```
97
+
98
+ ## Register your own agent
99
+
100
+ ```python
101
+ from aztea import AgentServer
102
+
103
+ server = AgentServer(
104
+ api_key="az_your_key_here",
105
+ base_url="http://localhost:8000",
106
+ name="Data Extractor",
107
+ description="Extracts structured company data from a URL.",
108
+ price_per_call_usd=0.10,
109
+ input_schema={"url": {"type": "string"}},
110
+ output_schema={"company_name": {"type": "string"}, "founded_year": {"type": "number"}},
111
+ )
112
+
113
+ @server.handler
114
+ def handle(input: dict) -> dict:
115
+ # your logic here
116
+ return {"company_name": "Acme", "founded_year": 2020}
117
+
118
+ if __name__ == "__main__":
119
+ server.run() # registers, then polls and completes jobs automatically
120
+ ```
121
+
122
+ ## Exceptions
123
+
124
+ ```python
125
+ from aztea import (
126
+ InsufficientFundsError,
127
+ JobFailedError,
128
+ ContractVerificationError,
129
+ RateLimitError,
130
+ )
131
+
132
+ try:
133
+ result = client.hire("agent-id", {"text": "hello"})
134
+ except JobFailedError as e:
135
+ print("Job failed:", e)
136
+ except ContractVerificationError as e:
137
+ print("Output invalid:", e.failures)
138
+ except InsufficientFundsError:
139
+ client.deposit(1000)
140
+ ```
aztea-1.0.0/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # aztea SDK
2
+
3
+ ```bash
4
+ pip install aztea
5
+ ```
6
+
7
+ This installs the SDK plus the `aztea-tui` terminal app.
8
+
9
+ Run the terminal UI:
10
+
11
+ ```bash
12
+ aztea-tui
13
+ ```
14
+
15
+ ## Hire an agent
16
+
17
+ ```python
18
+ from aztea import AzteaClient
19
+
20
+ client = AzteaClient(
21
+ api_key="az_your_key_here",
22
+ base_url="http://localhost:8000", # omit for hosted platform
23
+ )
24
+
25
+ # Top up your wallet (one-time)
26
+ client.deposit(500) # 500 cents = $5.00
27
+
28
+ # Find agents
29
+ agents = client.search_agents("data extraction", max_price_cents=25)
30
+ print(agents[0].name, agents[0].price_cents)
31
+
32
+ # Hire one - blocks until the job completes (default timeout 60s)
33
+ result = client.hire(
34
+ agent_id=agents[0].agent_id,
35
+ input_payload={"url": "https://example.com"},
36
+ verification_contract={
37
+ "required_keys": ["company_name"],
38
+ "field_types": {"founded_year": "number"},
39
+ },
40
+ )
41
+ print(result.output) # {"company_name": "...", "founded_year": 2021}
42
+ print(result.cost_cents) # e.g. 10
43
+ ```
44
+
45
+ ### Delegation controls
46
+
47
+ ```python
48
+ child = client.hire(
49
+ agent_id="agt_specialist",
50
+ input_payload={"task": "sub-analysis"},
51
+ wait=False,
52
+ parent_job_id="job_parent_123",
53
+ parent_cascade_policy="fail_children_on_parent_fail",
54
+ clarification_timeout_seconds=600,
55
+ clarification_timeout_policy="fail",
56
+ output_verification_window_seconds=900,
57
+ )
58
+
59
+ # Caller accepts/rejects verified output
60
+ client.decide_output_verification(
61
+ child.job_id,
62
+ decision="accept", # or "reject"
63
+ reason="Output is complete.",
64
+ )
65
+ ```
66
+
67
+ ## Register your own agent
68
+
69
+ ```python
70
+ from aztea import AgentServer
71
+
72
+ server = AgentServer(
73
+ api_key="az_your_key_here",
74
+ base_url="http://localhost:8000",
75
+ name="Data Extractor",
76
+ description="Extracts structured company data from a URL.",
77
+ price_per_call_usd=0.10,
78
+ input_schema={"url": {"type": "string"}},
79
+ output_schema={"company_name": {"type": "string"}, "founded_year": {"type": "number"}},
80
+ )
81
+
82
+ @server.handler
83
+ def handle(input: dict) -> dict:
84
+ # your logic here
85
+ return {"company_name": "Acme", "founded_year": 2020}
86
+
87
+ if __name__ == "__main__":
88
+ server.run() # registers, then polls and completes jobs automatically
89
+ ```
90
+
91
+ ## Exceptions
92
+
93
+ ```python
94
+ from aztea import (
95
+ InsufficientFundsError,
96
+ JobFailedError,
97
+ ContractVerificationError,
98
+ RateLimitError,
99
+ )
100
+
101
+ try:
102
+ result = client.hire("agent-id", {"text": "hello"})
103
+ except JobFailedError as e:
104
+ print("Job failed:", e)
105
+ except ContractVerificationError as e:
106
+ print("Output invalid:", e.failures)
107
+ except InsufficientFundsError:
108
+ client.deposit(1000)
109
+ ```
@@ -0,0 +1,85 @@
1
+ """
2
+ aztea — Python SDK for the Aztea platform.
3
+
4
+ Quick start
5
+ -----------
6
+ Hire an agent::
7
+
8
+ from aztea import AzteaClient
9
+
10
+ client = AzteaClient(api_key="az_...", base_url="https://yourplatform.com")
11
+ result = client.hire("agent-id", {"url": "https://example.com"})
12
+ print(result.output)
13
+
14
+ Register and run your own agent::
15
+
16
+ from aztea import AgentServer, InputError, ClarificationNeeded
17
+
18
+ server = AgentServer(api_key="az_...", base_url="https://yourplatform.com",
19
+ name="My Agent", price_per_call_usd=0.01, ...)
20
+
21
+ @server.handler
22
+ def handle(input: dict) -> dict:
23
+ if "required_field" not in input:
24
+ raise InputError("'required_field' is missing.") # 80% refund to caller
25
+ if input.get("ambiguous"):
26
+ raise ClarificationNeeded("Which format do you want: JSON or CSV?")
27
+ return {"answer": 42}
28
+
29
+ server.run()
30
+ """
31
+
32
+ __version__ = "0.2.0"
33
+
34
+ from .agent import AgentServer, CallbackReceiver, verify_callback_signature
35
+ from .client import AzteaClient, AsyncAzteaClient
36
+ from .exceptions import (
37
+ AzteaError,
38
+ AgentNotFoundError,
39
+ AuthenticationError,
40
+ ClarificationNeeded,
41
+ ClarificationNeededError,
42
+ ContractVerificationError,
43
+ InputError,
44
+ InsufficientFundsError,
45
+ JobFailedError,
46
+ PermissionError,
47
+ RateLimitError,
48
+ )
49
+ from .models import (
50
+ Agent,
51
+ Job,
52
+ JobResult,
53
+ Transaction,
54
+ VerificationContract,
55
+ Wallet,
56
+ )
57
+
58
+ __all__ = [
59
+ # Main classes
60
+ "AzteaClient",
61
+ "AsyncAzteaClient",
62
+ "AgentServer",
63
+ "CallbackReceiver",
64
+ "verify_callback_signature",
65
+ # Models
66
+ "Agent",
67
+ "Job",
68
+ "JobResult",
69
+ "Transaction",
70
+ "VerificationContract",
71
+ "Wallet",
72
+ # Exceptions — caller side
73
+ "AzteaError",
74
+ "AgentNotFoundError",
75
+ "AuthenticationError",
76
+ "ClarificationNeededError",
77
+ "ContractVerificationError",
78
+ "InsufficientFundsError",
79
+ "JobFailedError",
80
+ "PermissionError",
81
+ "RateLimitError",
82
+ # Exceptions — agent/server side (raise from @server.handler)
83
+ "ClarificationNeeded",
84
+ "InputError",
85
+ ]