Agents and runtimes¶
Define agents, choose a runtime, attach tools and manage conversation turns.
Choose your client · Reliability · All public exports
Agent
dataclass
¶
Agent(
name: str,
instructions: str = "",
model: str | Model | None = None,
provider: str | None = None,
tools: Sequence[Tool | Callable[..., Any]] = (),
profile_options: dict[str, Any] = dict(),
session_options: dict[str, Any] = dict(),
*,
config: dict[str, Any] = dict(),
max_turns: int | None = None,
toolsets: Sequence[str] | None = None,
)
Declarative profile configuration; does no I/O until attached to an instance.
BoundAgent ¶
Bases: ProfileResource
session
property
¶
The active session, including turns, actions and the event stream.
rpc
async
¶
Escape hatch to any native Hermes gateway method.
open_session
async
¶
Select an existing conversation after checking its instance/profile ownership.
add_tools
async
¶
Attach another Python tool bundle to this profile and refresh its live sessions.
remove_tools
async
¶
Remove this profile's binding; revoke owned callbacks when no binding still uses them.
start
async
¶
start(
prompt: str | list[ContentPart],
*,
mode: Literal["enqueue", "steer"] | Unset = UNSET,
tool_binding_ids: list[str] | Unset = UNSET,
metadata: dict[str, Any] | Unset = UNSET,
idempotency_key: str | Unset = UNSET,
) -> TurnResource
Submit without waiting; the handle supports get/wait/stop/steer/approve.
Consume agent.session.events() separately for the session's SSE stream. Tool bindings must already exist; support is determined by the server.
run
async
¶
run(
prompt: str | list[ContentPart],
*,
timeout: float = 300,
tool_binding_ids: list[str] | Unset = UNSET,
metadata: dict[str, Any] | Unset = UNSET,
idempotency_key: str | Unset = UNSET,
) -> RunResult
Wait for completion or a pending approval, not just the submit ACK.
Docker
dataclass
¶
Docker(
image: str = "nousresearch/hermes-agent:latest",
cpu: str = "1",
memory: str = "2Gi",
environment: dict[str, str] = dict(),
options: dict[str, Any] = dict(),
)
environment
class-attribute
instance-attribute
¶
External
dataclass
¶
External(
endpoint: str,
authorization: dict[str, str] = (
lambda: {"scheme": "none"}
)(),
options: dict[str, Any] = dict(),
)
authorization
class-attribute
instance-attribute
¶
Hermes ¶
Hermes(
sdk: AsyncEdithHermes,
*,
runtime: Runtime | None = None,
owner: dict[str, str] | None = None,
tool_host: ToolHost | None = None,
)
Bases: RootResource
High-level orchestration; .sdk preserves every existing low-level namespace.
cloud
property
¶
Unpinned provider extension API; no official typed cloud contract is available.
remote
classmethod
¶
remote(
base_url: str,
*,
token: str | None = None,
runtime: Runtime | None = None,
owner: dict[str, str] | None = None,
tool_host: ToolHost | None = None,
timeout: float = 30,
max_retries: int = 2,
) -> Hermes
Connect to a control plane. No runtime/auth/storage service is implicitly installed.
aclose
async
¶
Close client connections; does not delete remote instances or stop an external ToolHost.
local
async
classmethod
¶
local(
*,
runtime: Runtime | None = None,
state: str = ".edith-hermes/state.db",
cleanup: bool = True,
tools_host: str | None = None,
settings: Any = None,
) -> AsyncIterator[Hermes]
Local Docker/process control plane; optional SQLite state, no PostgreSQL/OIDC/KMS.
cleanup=True deletes instances created in this context. Set False for persistent instances; their Python callback tools are only reachable while this context lives. Kubernetes control planes should run in-cluster (use Hermes(existing_sdk,...)).
open_instance
async
¶
Attach handles to an existing SDK-managed instance; never takes cleanup ownership.
create_instance
async
¶
create_instance(
name: str,
*,
agents: Sequence[Agent] = (),
timeout: float = 300,
runtime: Runtime | None = None,
owner: dict[str, str] | None = None,
options: dict[str, Any] | None = None,
) -> Instance
Instance ¶
Bases: InstanceResource
Kubernetes
dataclass
¶
Kubernetes(
image: str,
namespace: str = "hermes-runtimes",
cpu: str = "1",
memory: str = "2Gi",
options: dict[str, Any] = dict(),
)
Model
dataclass
¶
Process
dataclass
¶
RunResult
dataclass
¶
Runtime ¶
Bases: Protocol
Implement this protocol to supply another runtime configuration.
Tool
dataclass
¶
ToolHost ¶
Expose only capability-authenticated callbacks/MCP, not anonymous control-plane routes.
unregister ¶
Revoke a callback capability, e.g. after removing its tool binding.
tool ¶
Expose an annotated Python function to Hermes; generates its JSON schema.