Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.4.0"
".": "0.5.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 3
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/agentbase%2Fagentbase-461274f650eccdf115b96ee1dbf1c0d4eb31485992cedc84ee0187aec72d63a5.yml
openapi_spec_hash: b8fa5fd0c89d9004d608af6061d0bf28
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/agentbase%2Fagentbase-c12be3e0fb0d0456a9dfdb9ba32d89ef3ffcd3561e945b22aff45ead12453358.yml
openapi_spec_hash: fea6f0cc71a01188f51a84d6a7ba7258
config_hash: 8d9b688cf969a1760b1300b65b80e796
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 0.5.0 (2025-11-06)

Full Changelog: [v0.4.0...v0.5.0](https://github.com/AgentbaseHQ/agentbase-python/compare/v0.4.0...v0.5.0)

### Features

* **api:** manual updates ([bd37cc0](https://github.com/AgentbaseHQ/agentbase-python/commit/bd37cc02bc033ed9a02a0fe412304620b1312884))


### Bug Fixes

* **client:** close streams without requiring full consumption ([600e68b](https://github.com/AgentbaseHQ/agentbase-python/commit/600e68b0722c43c174af329d83a866dba0e62e7c))


### Chores

* bump `httpx-aiohttp` version to 0.1.9 ([1a2887c](https://github.com/AgentbaseHQ/agentbase-python/commit/1a2887c6b9db2682267a3a28999227c3f5d857de))
* **internal/tests:** avoid race condition with implicit client cleanup ([c01d166](https://github.com/AgentbaseHQ/agentbase-python/commit/c01d166af2db0d272a571f244c088ff3dcd91bed))
* **internal:** grammar fix (it's -> its) ([e501e14](https://github.com/AgentbaseHQ/agentbase-python/commit/e501e1463942a61a8eea51fb86e83ed56cb76b59))

## 0.4.0 (2025-10-11)

Full Changelog: [v0.3.1...v0.4.0](https://github.com/AgentbaseHQ/agentbase-python/compare/v0.3.1...v0.4.0)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "agentbase-sdk"
version = "0.4.0"
version = "0.5.0"
description = "The official Python library for the agentbase API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -39,7 +39,7 @@ Homepage = "https://github.com/AgentbaseHQ/agentbase-python"
Repository = "https://github.com/AgentbaseHQ/agentbase-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]

[tool.rye]
managed = true
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ httpx==0.28.1
# via agentbase-sdk
# via httpx-aiohttp
# via respx
httpx-aiohttp==0.1.8
httpx-aiohttp==0.1.9
# via agentbase-sdk
idna==3.4
# via anyio
Expand Down
2 changes: 1 addition & 1 deletion requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ httpcore==1.0.9
httpx==0.28.1
# via agentbase-sdk
# via httpx-aiohttp
httpx-aiohttp==0.1.8
httpx-aiohttp==0.1.9
# via agentbase-sdk
idna==3.4
# via anyio
Expand Down
12 changes: 12 additions & 0 deletions src/agentbase/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def run_agent(
*,
message: str,
session: str | Omit = omit,
agents: Iterable[client_run_agent_params.Agent] | Omit = omit,
background: bool | Omit = omit,
callback: client_run_agent_params.Callback | Omit = omit,
datastores: Iterable[client_run_agent_params.Datastore] | Omit = omit,
Expand Down Expand Up @@ -236,6 +237,10 @@ def run_agent(
session: The session ID to continue the agent session conversation. If not provided, a
new session will be created.

agents: A set of agent configurations that enables the agent to transfer conversations
to other specialized agents. When provided, the main agent will have access to
seamless handoffs between agents based on the conversation context.

background: Whether to run the agent asynchronously on the server. When set to true, use
callback parameter to receive events.

Expand Down Expand Up @@ -282,6 +287,7 @@ def run_agent(
body=maybe_transform(
{
"message": message,
"agents": agents,
"background": background,
"callback": callback,
"datastores": datastores,
Expand Down Expand Up @@ -483,6 +489,7 @@ async def run_agent(
*,
message: str,
session: str | Omit = omit,
agents: Iterable[client_run_agent_params.Agent] | Omit = omit,
background: bool | Omit = omit,
callback: client_run_agent_params.Callback | Omit = omit,
datastores: Iterable[client_run_agent_params.Datastore] | Omit = omit,
Expand Down Expand Up @@ -517,6 +524,10 @@ async def run_agent(
session: The session ID to continue the agent session conversation. If not provided, a
new session will be created.

agents: A set of agent configurations that enables the agent to transfer conversations
to other specialized agents. When provided, the main agent will have access to
seamless handoffs between agents based on the conversation context.

background: Whether to run the agent asynchronously on the server. When set to true, use
callback parameter to receive events.

Expand Down Expand Up @@ -563,6 +574,7 @@ async def run_agent(
body=await async_maybe_transform(
{
"message": message,
"agents": agents,
"background": background,
"callback": callback,
"datastores": datastores,
Expand Down
10 changes: 4 additions & 6 deletions src/agentbase/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]:
for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
for _sse in iterator:
...
# As we might not fully consume the response stream, we need to close it explicitly
response.close()

def __enter__(self) -> Self:
return self
Expand Down Expand Up @@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
async for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
async for _sse in iterator:
...
# As we might not fully consume the response stream, we need to close it explicitly
await response.aclose()

async def __aenter__(self) -> Self:
return self
Expand Down
2 changes: 1 addition & 1 deletion src/agentbase/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
# Type safe methods for narrowing types with TypeVars.
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
# however this cause Pyright to rightfully report errors. As we know we don't
# care about the contained types we can safely use `object` in it's place.
# care about the contained types we can safely use `object` in its place.
#
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
# `is_*` is for when you're dealing with an unknown input
Expand Down
2 changes: 1 addition & 1 deletion src/agentbase/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "agentbase"
__version__ = "0.4.0" # x-release-please-version
__version__ = "0.5.0" # x-release-please-version
12 changes: 12 additions & 0 deletions src/agentbase/resources/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def run(
*,
message: str,
session: str | Omit = omit,
agents: Iterable[agent_run_params.Agent] | Omit = omit,
background: bool | Omit = omit,
callback: agent_run_params.Callback | Omit = omit,
datastores: Iterable[agent_run_params.Datastore] | Omit = omit,
Expand Down Expand Up @@ -85,6 +86,10 @@ def run(
session: The session ID to continue the agent session conversation. If not provided, a
new session will be created.

agents: A set of agent configurations that enables the agent to transfer conversations
to other specialized agents. When provided, the main agent will have access to
seamless handoffs between agents based on the conversation context.

background: Whether to run the agent asynchronously on the server. When set to true, use
callback parameter to receive events.

Expand Down Expand Up @@ -131,6 +136,7 @@ def run(
body=maybe_transform(
{
"message": message,
"agents": agents,
"background": background,
"callback": callback,
"datastores": datastores,
Expand Down Expand Up @@ -183,6 +189,7 @@ async def run(
*,
message: str,
session: str | Omit = omit,
agents: Iterable[agent_run_params.Agent] | Omit = omit,
background: bool | Omit = omit,
callback: agent_run_params.Callback | Omit = omit,
datastores: Iterable[agent_run_params.Datastore] | Omit = omit,
Expand Down Expand Up @@ -218,6 +225,10 @@ async def run(
session: The session ID to continue the agent session conversation. If not provided, a
new session will be created.

agents: A set of agent configurations that enables the agent to transfer conversations
to other specialized agents. When provided, the main agent will have access to
seamless handoffs between agents based on the conversation context.

background: Whether to run the agent asynchronously on the server. When set to true, use
callback parameter to receive events.

Expand Down Expand Up @@ -264,6 +275,7 @@ async def run(
body=await async_maybe_transform(
{
"message": message,
"agents": agents,
"background": background,
"callback": callback,
"datastores": datastores,
Expand Down
16 changes: 16 additions & 0 deletions src/agentbase/types/agent_run_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

__all__ = [
"AgentRunParams",
"Agent",
"Callback",
"Datastore",
"FinalOutput",
Expand All @@ -31,6 +32,13 @@ class AgentRunParams(TypedDict, total=False):
If not provided, a new session will be created.
"""

agents: Iterable[Agent]
"""
A set of agent configurations that enables the agent to transfer conversations
to other specialized agents. When provided, the main agent will have access to
seamless handoffs between agents based on the conversation context.
"""

background: bool
"""Whether to run the agent asynchronously on the server.

Expand Down Expand Up @@ -92,6 +100,14 @@ class AgentRunParams(TypedDict, total=False):
"""


class Agent(TypedDict, total=False):
description: Required[str]
"""Description of what this agent handles"""

name: Required[str]
"""The name of the agent to transfer to"""


class Callback(TypedDict, total=False):
url: Required[str]
"""The webhook URL to send events to."""
Expand Down
16 changes: 16 additions & 0 deletions src/agentbase/types/client_run_agent_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

__all__ = [
"ClientRunAgentParams",
"Agent",
"Callback",
"Datastore",
"FinalOutput",
Expand All @@ -31,6 +32,13 @@ class ClientRunAgentParams(TypedDict, total=False):
If not provided, a new session will be created.
"""

agents: Iterable[Agent]
"""
A set of agent configurations that enables the agent to transfer conversations
to other specialized agents. When provided, the main agent will have access to
seamless handoffs between agents based on the conversation context.
"""

background: bool
"""Whether to run the agent asynchronously on the server.

Expand Down Expand Up @@ -92,6 +100,14 @@ class ClientRunAgentParams(TypedDict, total=False):
"""


class Agent(TypedDict, total=False):
description: Required[str]
"""Description of what this agent handles"""

name: Required[str]
"""The name of the agent to transfer to"""


class Callback(TypedDict, total=False):
url: Required[str]
"""The webhook URL to send events to."""
Expand Down
12 changes: 12 additions & 0 deletions tests/api_resources/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def test_method_run_with_all_params(self, client: Agentbase) -> None:
agent_stream = client.agent.run(
message="message",
session="session",
agents=[
{
"description": "description",
"name": "name",
}
],
background=True,
callback={
"url": "https://example.com",
Expand Down Expand Up @@ -131,6 +137,12 @@ async def test_method_run_with_all_params(self, async_client: AsyncAgentbase) ->
agent_stream = await async_client.agent.run(
message="message",
session="session",
agents=[
{
"description": "description",
"name": "name",
}
],
background=True,
callback={
"url": "https://example.com",
Expand Down
12 changes: 12 additions & 0 deletions tests/api_resources/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def test_method_run_agent_with_all_params(self, client: Agentbase) -> None:
client_stream = client.run_agent(
message="message",
session="session",
agents=[
{
"description": "description",
"name": "name",
}
],
background=True,
callback={
"url": "https://example.com",
Expand Down Expand Up @@ -131,6 +137,12 @@ async def test_method_run_agent_with_all_params(self, async_client: AsyncAgentba
client_stream = await async_client.run_agent(
message="message",
session="session",
agents=[
{
"description": "description",
"name": "name",
}
],
background=True,
callback={
"url": "https://example.com",
Expand Down
Loading