Skip to content

Commit 0dd1219

Browse files
feat(api): manual updates
1 parent e7a19d7 commit 0dd1219

24 files changed

Lines changed: 1493 additions & 609 deletions

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 3
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/agentbase%2Fagentbase-b248631a2800e6d0f22a253717a63a551d9305e4c990dceb2f5c5361c519fa24.yml
3-
openapi_spec_hash: 4c06f6155fb614add9b30cd294266e11
4-
config_hash: 2ad1177ae9ac1a57dc61c0f7e142fc06
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/agentbase%2Fagentbase-461274f650eccdf115b96ee1dbf1c0d4eb31485992cedc84ee0187aec72d63a5.yml
3+
openapi_spec_hash: b8fa5fd0c89d9004d608af6061d0bf28
4+
config_hash: 8d9b688cf969a1760b1300b65b80e796

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1515

1616
## Documentation
1717

18-
The full API of this library can be found in [api.md](api.md).
18+
The REST API documentation can be found on [docs.agentbase.sh](https://docs.agentbase.sh). The full API of this library can be found in [api.md](api.md).
1919

2020
## Installation
2121

@@ -142,6 +142,22 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
142142

143143
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
144144

145+
## Nested params
146+
147+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
148+
149+
```python
150+
from agentbase import Agentbase
151+
152+
client = Agentbase()
153+
154+
response = client.run_agent(
155+
message="message",
156+
callback={"url": "https://example.com"},
157+
)
158+
print(response.callback)
159+
```
160+
145161
## Handling errors
146162

147163
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `agentbase.APIConnectionError` is raised.

SECURITY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ before making any information public.
1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
1919
or products provided by Agentbase, please follow the respective company's security reporting guidelines.
2020

21+
### Agentbase Terms and Policies
22+
23+
Please contact team@agentbase.sh for any questions or concerns regarding the security of our services.
24+
2125
---
2226

2327
Thank you for helping us keep the SDKs and systems they interact with secure.

api.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,27 @@ Methods:
1010

1111
- <code title="post /">client.<a href="./src/agentbase/_client.py">run_agent</a>(\*\*<a href="src/agentbase/types/client_run_agent_params.py">params</a>) -> str</code>
1212

13-
# GetMessages
13+
# Agent
1414

1515
Types:
1616

1717
```python
18-
from agentbase.types import GetMessageRetrieveResponse
18+
from agentbase.types import AgentRunResponse
1919
```
2020

2121
Methods:
2222

23-
- <code title="post /get-messages">client.get_messages.<a href="./src/agentbase/resources/get_messages.py">retrieve</a>(\*\*<a href="src/agentbase/types/get_message_retrieve_params.py">params</a>) -> <a href="./src/agentbase/types/get_message_retrieve_response.py">GetMessageRetrieveResponse</a></code>
23+
- <code title="post /">client.agent.<a href="./src/agentbase/resources/agent.py">run</a>(\*\*<a href="src/agentbase/types/agent_run_params.py">params</a>) -> str</code>
2424

25-
# ClearMessages
25+
# Messages
2626

2727
Types:
2828

2929
```python
30-
from agentbase.types import ClearMessageClearResponse
30+
from agentbase.types import MessageClearResponse, MessageGetResponse
3131
```
3232

3333
Methods:
3434

35-
- <code title="post /clear-messages">client.clear_messages.<a href="./src/agentbase/resources/clear_messages.py">clear</a>(\*\*<a href="src/agentbase/types/clear_message_clear_params.py">params</a>) -> <a href="./src/agentbase/types/clear_message_clear_response.py">ClearMessageClearResponse</a></code>
35+
- <code title="post /clear-messages">client.messages.<a href="./src/agentbase/resources/messages.py">clear</a>(\*\*<a href="src/agentbase/types/message_clear_params.py">params</a>) -> <a href="./src/agentbase/types/message_clear_response.py">MessageClearResponse</a></code>
36+
- <code title="post /get-messages">client.messages.<a href="./src/agentbase/resources/messages.py">get</a>(\*\*<a href="src/agentbase/types/message_get_params.py">params</a>) -> <a href="./src/agentbase/types/message_get_response.py">MessageGetResponse</a></code>

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "The official Python library for the agentbase API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
77
authors = [
8-
{ name = "Agentbase", email = "" },
8+
{ name = "Agentbase", email = "team@agentbase.sh" },
99
]
1010
dependencies = [
1111
"httpx>=0.23.0, <1",

src/agentbase/_client.py

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
async_to_raw_response_wrapper,
3939
async_to_streamed_response_wrapper,
4040
)
41-
from .resources import get_messages, clear_messages
41+
from .resources import agent, messages
4242
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
4343
from ._exceptions import AgentbaseError, APIStatusError
4444
from ._base_client import (
@@ -62,8 +62,8 @@
6262

6363

6464
class Agentbase(SyncAPIClient):
65-
get_messages: get_messages.GetMessagesResource
66-
clear_messages: clear_messages.ClearMessagesResource
65+
agent: agent.AgentResource
66+
messages: messages.MessagesResource
6767
with_raw_response: AgentbaseWithRawResponse
6868
with_streaming_response: AgentbaseWithStreamedResponse
6969

@@ -121,8 +121,8 @@ def __init__(
121121
_strict_response_validation=_strict_response_validation,
122122
)
123123

124-
self.get_messages = get_messages.GetMessagesResource(self)
125-
self.clear_messages = clear_messages.ClearMessagesResource(self)
124+
self.agent = agent.AgentResource(self)
125+
self.messages = messages.MessagesResource(self)
126126
self.with_raw_response = AgentbaseWithRawResponse(self)
127127
self.with_streaming_response = AgentbaseWithStreamedResponse(self)
128128

@@ -202,12 +202,17 @@ def run_agent(
202202
*,
203203
message: str,
204204
session: str | Omit = omit,
205+
background: bool | Omit = omit,
206+
callback: client_run_agent_params.Callback | Omit = omit,
205207
datastores: Iterable[client_run_agent_params.Datastore] | Omit = omit,
208+
final_output: client_run_agent_params.FinalOutput | Omit = omit,
206209
mcp_servers: Iterable[client_run_agent_params.McpServer] | Omit = omit,
207210
mode: Literal["flash", "fast", "max"] | Omit = omit,
211+
queries: Iterable[client_run_agent_params.Query] | Omit = omit,
208212
rules: SequenceNotStr[str] | Omit = omit,
209213
streaming_tokens: bool | Omit = omit,
210214
system: str | Omit = omit,
215+
workflows: Iterable[client_run_agent_params.Workflow] | Omit = omit,
211216
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
212217
# The extra values given here take precedence over values defined on the client or passed to this method.
213218
extra_headers: Headers | None = None,
@@ -231,21 +236,38 @@ def run_agent(
231236
session: The session ID to continue the agent session conversation. If not provided, a
232237
new session will be created.
233238
239+
background: Whether to run the agent asynchronously on the server. When set to true, use
240+
callback parameter to receive events.
241+
242+
callback: A callback endpoint configuration to send agent message events back to. Use with
243+
background true.
244+
234245
datastores: A set of datastores for the agent to utilize. Each object must include a `id`
235246
and `name`.
236247
248+
final_output: Configuration for an extra final output event that processes the entire agent
249+
message thread and produces a structured output based on the provided JSON
250+
schema.
251+
237252
mcp_servers: A list of MCP server configurations. Each object must include a `serverName` and
238253
`serverUrl`.
239254
240255
mode: The agent mode. Allowed values are `flash`, `fast` or `max`. Defaults to `fast`
241256
if not supplied.
242257
258+
queries: A set of custom actions based on datastore (database) queries. Allows you to
259+
quickly define actions that the agent can use to query your datastores.
260+
243261
rules: A list of constraints that the agent must follow.
244262
245263
streaming_tokens: Whether to stream the agent messages token by token.
246264
247265
system: A system prompt to provide system information to the agent.
248266
267+
workflows: A set of declarative workflows for the agent to execute. Each workflow is a DAG
268+
(Directed Acyclic Graph) of steps that the agent interprets and executes
269+
dynamically.
270+
249271
extra_headers: Send extra headers
250272
251273
extra_query: Add additional query parameters to the request
@@ -260,12 +282,17 @@ def run_agent(
260282
body=maybe_transform(
261283
{
262284
"message": message,
285+
"background": background,
286+
"callback": callback,
263287
"datastores": datastores,
288+
"final_output": final_output,
264289
"mcp_servers": mcp_servers,
265290
"mode": mode,
291+
"queries": queries,
266292
"rules": rules,
267293
"streaming_tokens": streaming_tokens,
268294
"system": system,
295+
"workflows": workflows,
269296
},
270297
client_run_agent_params.ClientRunAgentParams,
271298
),
@@ -316,8 +343,8 @@ def _make_status_error(
316343

317344

318345
class AsyncAgentbase(AsyncAPIClient):
319-
get_messages: get_messages.AsyncGetMessagesResource
320-
clear_messages: clear_messages.AsyncClearMessagesResource
346+
agent: agent.AsyncAgentResource
347+
messages: messages.AsyncMessagesResource
321348
with_raw_response: AsyncAgentbaseWithRawResponse
322349
with_streaming_response: AsyncAgentbaseWithStreamedResponse
323350

@@ -375,8 +402,8 @@ def __init__(
375402
_strict_response_validation=_strict_response_validation,
376403
)
377404

378-
self.get_messages = get_messages.AsyncGetMessagesResource(self)
379-
self.clear_messages = clear_messages.AsyncClearMessagesResource(self)
405+
self.agent = agent.AsyncAgentResource(self)
406+
self.messages = messages.AsyncMessagesResource(self)
380407
self.with_raw_response = AsyncAgentbaseWithRawResponse(self)
381408
self.with_streaming_response = AsyncAgentbaseWithStreamedResponse(self)
382409

@@ -456,12 +483,17 @@ async def run_agent(
456483
*,
457484
message: str,
458485
session: str | Omit = omit,
486+
background: bool | Omit = omit,
487+
callback: client_run_agent_params.Callback | Omit = omit,
459488
datastores: Iterable[client_run_agent_params.Datastore] | Omit = omit,
489+
final_output: client_run_agent_params.FinalOutput | Omit = omit,
460490
mcp_servers: Iterable[client_run_agent_params.McpServer] | Omit = omit,
461491
mode: Literal["flash", "fast", "max"] | Omit = omit,
492+
queries: Iterable[client_run_agent_params.Query] | Omit = omit,
462493
rules: SequenceNotStr[str] | Omit = omit,
463494
streaming_tokens: bool | Omit = omit,
464495
system: str | Omit = omit,
496+
workflows: Iterable[client_run_agent_params.Workflow] | Omit = omit,
465497
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
466498
# The extra values given here take precedence over values defined on the client or passed to this method.
467499
extra_headers: Headers | None = None,
@@ -485,21 +517,38 @@ async def run_agent(
485517
session: The session ID to continue the agent session conversation. If not provided, a
486518
new session will be created.
487519
520+
background: Whether to run the agent asynchronously on the server. When set to true, use
521+
callback parameter to receive events.
522+
523+
callback: A callback endpoint configuration to send agent message events back to. Use with
524+
background true.
525+
488526
datastores: A set of datastores for the agent to utilize. Each object must include a `id`
489527
and `name`.
490528
529+
final_output: Configuration for an extra final output event that processes the entire agent
530+
message thread and produces a structured output based on the provided JSON
531+
schema.
532+
491533
mcp_servers: A list of MCP server configurations. Each object must include a `serverName` and
492534
`serverUrl`.
493535
494536
mode: The agent mode. Allowed values are `flash`, `fast` or `max`. Defaults to `fast`
495537
if not supplied.
496538
539+
queries: A set of custom actions based on datastore (database) queries. Allows you to
540+
quickly define actions that the agent can use to query your datastores.
541+
497542
rules: A list of constraints that the agent must follow.
498543
499544
streaming_tokens: Whether to stream the agent messages token by token.
500545
501546
system: A system prompt to provide system information to the agent.
502547
548+
workflows: A set of declarative workflows for the agent to execute. Each workflow is a DAG
549+
(Directed Acyclic Graph) of steps that the agent interprets and executes
550+
dynamically.
551+
503552
extra_headers: Send extra headers
504553
505554
extra_query: Add additional query parameters to the request
@@ -514,12 +563,17 @@ async def run_agent(
514563
body=await async_maybe_transform(
515564
{
516565
"message": message,
566+
"background": background,
567+
"callback": callback,
517568
"datastores": datastores,
569+
"final_output": final_output,
518570
"mcp_servers": mcp_servers,
519571
"mode": mode,
572+
"queries": queries,
520573
"rules": rules,
521574
"streaming_tokens": streaming_tokens,
522575
"system": system,
576+
"workflows": workflows,
523577
},
524578
client_run_agent_params.ClientRunAgentParams,
525579
),
@@ -571,8 +625,8 @@ def _make_status_error(
571625

572626
class AgentbaseWithRawResponse:
573627
def __init__(self, client: Agentbase) -> None:
574-
self.get_messages = get_messages.GetMessagesResourceWithRawResponse(client.get_messages)
575-
self.clear_messages = clear_messages.ClearMessagesResourceWithRawResponse(client.clear_messages)
628+
self.agent = agent.AgentResourceWithRawResponse(client.agent)
629+
self.messages = messages.MessagesResourceWithRawResponse(client.messages)
576630

577631
self.run_agent = to_raw_response_wrapper(
578632
client.run_agent,
@@ -581,8 +635,8 @@ def __init__(self, client: Agentbase) -> None:
581635

582636
class AsyncAgentbaseWithRawResponse:
583637
def __init__(self, client: AsyncAgentbase) -> None:
584-
self.get_messages = get_messages.AsyncGetMessagesResourceWithRawResponse(client.get_messages)
585-
self.clear_messages = clear_messages.AsyncClearMessagesResourceWithRawResponse(client.clear_messages)
638+
self.agent = agent.AsyncAgentResourceWithRawResponse(client.agent)
639+
self.messages = messages.AsyncMessagesResourceWithRawResponse(client.messages)
586640

587641
self.run_agent = async_to_raw_response_wrapper(
588642
client.run_agent,
@@ -591,8 +645,8 @@ def __init__(self, client: AsyncAgentbase) -> None:
591645

592646
class AgentbaseWithStreamedResponse:
593647
def __init__(self, client: Agentbase) -> None:
594-
self.get_messages = get_messages.GetMessagesResourceWithStreamingResponse(client.get_messages)
595-
self.clear_messages = clear_messages.ClearMessagesResourceWithStreamingResponse(client.clear_messages)
648+
self.agent = agent.AgentResourceWithStreamingResponse(client.agent)
649+
self.messages = messages.MessagesResourceWithStreamingResponse(client.messages)
596650

597651
self.run_agent = to_streamed_response_wrapper(
598652
client.run_agent,
@@ -601,8 +655,8 @@ def __init__(self, client: Agentbase) -> None:
601655

602656
class AsyncAgentbaseWithStreamedResponse:
603657
def __init__(self, client: AsyncAgentbase) -> None:
604-
self.get_messages = get_messages.AsyncGetMessagesResourceWithStreamingResponse(client.get_messages)
605-
self.clear_messages = clear_messages.AsyncClearMessagesResourceWithStreamingResponse(client.clear_messages)
658+
self.agent = agent.AsyncAgentResourceWithStreamingResponse(client.agent)
659+
self.messages = messages.AsyncMessagesResourceWithStreamingResponse(client.messages)
606660

607661
self.run_agent = async_to_streamed_response_wrapper(
608662
client.run_agent,

0 commit comments

Comments
 (0)