Migrate from SDK 0.5.0
SDK 1.0.0 removes four arguments ofchat.start and chat.send. Their job is
now done by message_scope and thread_capabilities.
Message filters
disabled_tools was a list of things to turn off. A scope is a list of things
to change, so “everything except Notion” becomes “these connections”.
Memory namespace
The HTTP API
The HTTP API still accepts the old fields, but they are deprecated and will be removed in a later version. Each one maps to a new field:
Do not send an old field and a new one in the same object. The request fails
with a 422:
options.capabilitieswithoptions.memory_namespacemessage.scopewithdisabled_tools,source_idsordocument_ids
Where an error comes from
There are two kinds of errors, and they happen at different times.Local InvalidParams
The SDK checks every capability and scope object when you create it. Nothing is
sent. The message names the argument and the reason.
Catch it like any other SDK error:
Server-side 422 APIError
The server compares your message with the thread’s capabilities. A scope can
only narrow them. These three cases are refused:
scope.<name>, even if you sent the older source_ids field.
The server returns the error
detail in two shapes. A list when the request
body is malformed, and a plain string when the policy refuses it, as above.
Handle both if you call the HTTP API directly.TypeError
chat.send has no thread_capabilities, and neither method accepts the
removed arguments. Python raises a TypeError before the SDK runs:
options.capabilities on POST /chat/{thread_id} returns a 422.
Common mistakes
Trying to change capabilities on chat.send
The thread’s capabilities are frozen when it starts. chat.send only accepts
message_scope, which narrows one message. To use other capabilities, start a
new thread.
Using old and new fields together
On HTTP,message.scope together with disabled_tools, source_ids or
document_ids fails with a 422. In the SDK, the old arguments no longer exist.
Move everything to the new ones.
Passing True, False, or a string
There are no shortcuts. web=True, web="never", and MessageScope(web=False)
all raise InvalidParams. Use WebCapability(activation="never") and
WebScope(enabled=False).
Losing the agent’s source_ids
A capability you pass replaces the agent’s version entirely. If you redefine
indexed_documents, even only to change its activation to on_request, every
filter you leave out goes back to ALL. The thread can then search every
source. Repeat every filter you want to keep. See
Override an agent for one thread.
A capability stays on because you did not mention it
Capabilities you do not pass keep the agent’s value. If the agent has web search on, it stays on until you passWebCapability(activation="never").
An id that matches nothing
The API does not check source ids, document ids, connection names, or skill ids on a chat. A wrong id is accepted and finds nothing. If the agent answers that it sees no documents, or no Linear, check the id and the name against the platform. See Find your ids.The agent does not follow the scope
The request succeeds, but the answer ignores the scope:- You turned the web off and kept your documents on. The agent answers that it cannot find the information.
- You turned a capability on. The agent answers without using it.
Expecting a scope to last
A scope applies to one message. The next message without a scope goes back to the thread’s capabilities. Send the scope again on every message that needs it. This is also true ofon_request: it is off unless the message turns it on.
Expecting the agent’s never to be a lock
thread_capabilities can turn on a capability that the agent sets to never. If
you must keep a capability away from some callers, do not give them the API key
of an agent that has it.
Next steps
Capabilities
The definitions, activation modes, and filters.
Use cases
Recipes from one message to a full thread policy.