Skip to content
Draft
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
21 changes: 21 additions & 0 deletions sdk/guides/agent-file-based.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,27 @@ conversation = Conversation(

To learn more about agent delegation, follow our [comprehensive guide](/sdk/guides/task-tool-set).

## Disabling Sub-Agents per Conversation

`AgentContext.disabled_agents` is a per-conversation deny-list of sub-agent names, mirroring the `disabled_skills` model for skills. When the task tool or the delegate tool is asked to spawn a listed agent, the spawn is refused and the calling LLM receives a tool error naming the disabled agent, so it can pick another type or do the work itself.

```python icon="python"
from openhands.sdk import Agent, AgentContext, Tool
from openhands.tools.task import TaskToolSet

main_agent = Agent(
llm=llm,
tools=[Tool(name=TaskToolSet.name)],
agent_context=AgentContext(disabled_agents=["code-explorer"]),
)
```

Enforcement happens at spawn time, not registration time: the sub-agent registry is process-global and shared across conversations on the agent server, so unregistering an agent would remove it for every conversation in the process. A listed name that is not registered is a harmless no-op, and the default empty list disables nothing.

<Note>
`disabled_agents` rides the standard `AgentContext` plumbing, so server and frontend integrations can set it per conversation through the start-conversation settings payload (`agent_settings.agent_context.disabled_agents`).
</Note>

## Example Agent Files

### Code Reviewer
Expand Down