I would like to request session-scoped custom tool registration for the frontend anna.agent.session(...) API. Developers would provide tool names, descriptions, parameter schemas, and execution handlers when creating a session. The model could then select and call these tools directly, while the SDK/Host manages the complete tool-calling loop. Tool results should support both text and images, allowing the model to continue working with visual content returned by tools.
This would make it easier for Apps to expose existing business functions to a session, reducing the need to implement custom tool orchestration or create, register, and install a separate Executa for tools used only by that session.
Current capabilities and development limitations
Based on the current official documentation, my understanding is that an App Session’s tool set is resolved as follows:
Tools in AppToolRegistry
∩ manifest.ui.host_api.agent.tools
∩ quotaCaps.allowed_tools at session creation (if provided)
∩ allowed_tools for the current run (if provided)
The manifest setting tools: ["*"] covers only the platform registry, and inherit_host_tools has been retired for App Sessions. Adding custom names to agent.tools or allowed_tools only specifies filter conditions; it does not register new tool definitions.
The documentation currently describes these related options:
| Approach | How custom business tools are used |
|---|---|
An App calls Executa tools through anna.tools.invoke(...) |
App code decides when to call each tool and which arguments to pass |
An Executa plugin creates a session through agent/session.create |
By default, the session can inherit the host Copilot tool set, allowing the model to select Executa tools that meet installation, enablement, and Agent connection requirements |
These options cover the use of existing plugins, but the integration overhead remains significant for business functions that belong only to a particular App, or even just the current session. To let the model select these functions autonomously, developers need to maintain their own tool-calling loop or package the functions as an Executa and complete the corresponding integration process.
Practical use cases
Many Apps already have business APIs for reading the current document, updating specific content, querying application state, or saving edits. Developers want to make these existing capabilities available to a session so the model can select and combine them based on the user’s request.
For example, a document editing App could expose read_document and update_document to the current session. When the user requests an edit, the session would read the document, apply the changes, and explain the result. The App would only need to provide the two function definitions and implementations, without building a separate loop to parse model output, dispatch tools, submit results, and resume inference.
Tools may also return document page screenshots, charts, or previews of edits. The session should be able to see these images directly and use them alongside textual results for further analysis and editing.
The implementations could remain in the App or its backend, and the tool set could be chosen at session creation based on the current document, page, or workflow.
Requested capabilities
It would be helpful to have a standard tool definition and execution protocol that allows App developers to:
- Inject tool definitions at session creation: provide names, descriptions, and parameter schemas, for example using JSON Schema.
- Bind execution handlers: when the model selects a tool, the SDK dispatches the call to the corresponding function and returns its result to the Host.
- Automatically complete the tool-calling loop within the same run: the SDK/Host manages call correlation, argument validation, result submission, and model continuation, supporting sequential calls and parallel calls issued by the model.
- Scope tools to the current session: tools do not need to be added to the global platform registry or packaged as a separately installable Executa, and can be used alongside authorized platform tools.
- Support tool results containing images: reuse the
content + attachmentsstructure fromsession.runso tools can return text and images together, with the SDK/Host adding the images to the context as visual input the model can process. - Provide consistent execution events and error formats: tool calls have stable identifiers and events for start, completion, failure, timeout, and cancellation, making progress display and troubleshooting easier.
The App would still implement the business functions, while the SDK/Host handles the tool-calling protocol and run orchestration. Developers could focus on the tools themselves instead of reimplementing the Agent’s tool-calling loop for each App.
Suggested API shape
The following illustrates the desired developer experience and is not an existing API. The official API could define the field names, tool standard, and transport protocol. In this example, documentService represents an existing business API in the App, and doc.imageAttachments contains optional image attachments prepared in the session.run.attachments format.
const session = await anna.agent.session({
submode: "auto",
tools: [
{
name: "read_document",
description: "Read a specified document in the current application, returning its text and optional page images.",
inputSchema: {
type: "object",
properties: {
documentId: {
type: "string",
description: "The document ID within the current application"
}
},
required: ["documentId"],
additionalProperties: false
}
}
],
toolHandlers: {
read_document: async ({ documentId }) => {
const doc = await documentService.read(documentId);
return {
content: doc.content,
attachments: doc.imageAttachments ?? []
};
}
}
});
for await (const frame of session.run({
content: "Please read demo-document and summarize its main points."
})) {
// The App consumes streaming output and tool execution events as usual.
}
The toolHandlers here are local SDK callbacks; JavaScript functions do not need to be serialized into JSON-RPC requests. Tool definitions would be submitted through RPC, with execution requests and results exchanged through a standard SDK/Host protocol.
Reuse the existing attachment structure for tool results
Since session.run already accepts text and image attachments, custom tool results could reuse this structure and its processing pipeline where possible. For example, a tool returning a page screenshot could use the following result format:
{
"content": "This is a screenshot of page 3. Please check the layout alongside the document text.",
"attachments": [
{
"type": "image/png",
"url": "https://example.com/document-page-3.png",
"filename": "page-3.png",
"detail": "high"
}
]
}
The image URL above is a placeholder. In practice, the App could obtain an accessible URL through the existing upload capability, or the SDK could wrap the upload process, reusing existing attachment validation and visual input handling.
The proposal reuses the session.run data structure; tool results should be submitted to the current run, without starting a new user turn. The SDK would automatically correlate the current session, run_id, and tool_call_id, then submit the handler’s returned text and attachments to the Host. The Host would adapt them to the model’s message format and continue the same run. Images need to be passed as visual input to a vision-capable model, rather than merely including their URLs as plain text.
The expected flow would be:
The App creates a session, providing tool definitions and binding handlers
→ The model selects a tool based on the user's request
→ The SDK calls the corresponding business function
→ The SDK correlates the returned text and image attachments with the current tool call and submits them
→ The Host adds the results to the model's context and continues the same run
→ The App consumes the final response and execution events
This would make App Sessions easier to integrate with existing application capabilities and better suited to document editing, data queries, and interactive workflows. Please consider providing this API. If there is already a supported way to achieve this, documentation and a minimal example would also be helpful.