An autonomous (max_loops=“auto”) agent with terminal access that narrates its plan, tool use, and final summary in real time.
This example combines three Swarms features into one voice-driven agent:
max_loops="auto" — the autonomous plan → execute → summary loop.
selected_tools="all" — the agent picks up every available tool, including the built-in bash terminal.
StreamingTTSCallback — every token from every loop phase is narrated in real time.
The result is an agent that talks through its plan, the commands it runs, and its final summary — useful for accessibility, demos, and ambient operations dashboards.
from swarms import Agentagent = Agent( agent_name="Terminal-Agent", agent_description="Agent that can plan tasks and run bash commands on the terminal", model_name="anthropic/claude-sonnet-4-5", dynamic_temperature_enabled=True, max_loops="auto", dynamic_context_window=True, selected_tools="all", top_p=None, streaming_on=True, # the callback only receives tokens when the agent streams)
max_loops="auto" runs the agent through three phases — plan, execute, summary — looping until it decides the task is done. selected_tools="all" (the default) exposes every tool the autonomous looper has access to (bash, file ops, etc.). streaming_on=True is what makes the model stream, so the TTS callback receives tokens.
The TTS callback receives tokens from every phase of the autonomous loop — the planning step, each tool-call/synthesis turn, and the final summary.
if __name__ == "__main__": result = agent.run( task="Use the terminal to list the current directory, and see what files are in it.", streaming_callback=tts_callback, ) # Flush so the last sentence is spoken tts_callback.flush() print(result)
from swarms import Agentfrom voice_agents import StreamingTTSCallbackagent = Agent( agent_name="Terminal-Agent", agent_description="Agent that can plan tasks and run bash commands on the terminal", model_name="anthropic/claude-sonnet-4-5", dynamic_temperature_enabled=True, max_loops="auto", dynamic_context_window=True, selected_tools="all", top_p=None, streaming_on=True,)tts_callback = StreamingTTSCallback(voice="alloy", model="tts-1")if __name__ == "__main__": result = agent.run( task="Use the terminal to list the current directory, and see what files are in it.", streaming_callback=tts_callback, ) tts_callback.flush() print(result)
An autonomous agent with selected_tools="all" can execute bash commands. Run it inside a sandbox or scoped working directory if the task is untrusted.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"swarms","colors":{"primary":"#DC2626","light":"#FFFFFF","dark":"#000000"},"logo":{"light":"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/light.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=e3d664b8b8f6928c836776b54704d076","dark":"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/dark.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=d1f710292b2b40794b44a3168a6b09dc"},"favicon":"https://mintcdn.com/kyegomez-swarms-97/UEClO9jJGrigmMUe/logo.svg?fit=max\u0026auto=format\u0026n=UEClO9jJGrigmMUe\u0026q=85\u0026s=07dcb5f5b9bca5ec8fd6475dcc9b5484","navbar":{"primary":{"type":"github","href":"https://github.com/kyegomez/swarms"}},"footer":{"socials":{"twitter":"https://twitter.com/swarms_corp","github":"https://github.com/kyegomez/swarms","website":"https://swarms.ai","linkedin":"https://www.linkedin.com/company/the-swarm-corporation","discord":"https://discord.gg/EamjgSaEQf","youtube":"https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ","medium":"https://medium.com/@kyeg"}},"contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"kyegomez-swarms-97","hasAudioNarration":false,"actualSubdomain":"kyegomez-swarms-97","customDomains":["docs.swarms.world"],"gitSource":{"type":"github","owner":"the-swarm-corporation","repo":"swarms-framework-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ade27d790f989adb24ebb0c","collectionId":"0cb2ea24-451d-42c5-9222-5334866254f6","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ade27d790f989adb24ebb0c"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6ade27d790f989adb24ebb0c","clientVersion":"0.0.4054","searchFilterCounts":[{"language":"default","tag":"Examples","count":111},{"language":"default","tag":"Documentation","count":58},{"language":"default","tag":"API Reference","count":54},{"language":"default","tag":"Multi-Agent Harnesses","count":37},{"language":"default","tag":"RouteHub","count":17},{"language":"default","tag":"MCP Tool Integrations","count":15},{"language":"default","tag":"Community","count":13},{"language":"default","tag":"Model Providers","count":13},{"language":"default","tag":"Multi-Agent Architectures","count":12},{"language":"default","tag":"Integrations","count":12}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"examples/voice-agents/autonomous-agent-with-speech","slug":"/examples/voice-agents/autonomous-agent-with-speech","pageMetadata":{"title":"Autonomous Voice Agent","description":"An autonomous (max_loops=\"auto\") agent with terminal access that narrates its plan, tool use, and final summary in real time.","icon":"robot","href":"/examples/voice-agents/autonomous-agent-with-speech"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"An autonomous (max_loops=“auto”) agent with terminal access that narrates its plan, tool use, and final summary in real time.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`This example combines three Swarms features into one voice-driven agent:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`max_loops=\"auto\"`}),` — the autonomous plan → execute → summary loop.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`selected_tools=\"all\"`}),` — the agent picks up every available tool, including the built-in bash terminal.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`StreamingTTSCallback`}),` — every token from every loop phase is narrated in real time.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`The result is an agent that talks through its plan, the commands it runs, and its final summary — useful for accessibility, demos, and ambient operations dashboards.`}),`\n`,_jsx(Heading,{level:`2`,id:`step-1-install-dependencies`,children:`Step 1: Install dependencies`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -U`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` swarms`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` voice-agents`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ANTHROPIC_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sk-ant-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`... `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# this example uses Claude`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OPENAI_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sk-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`... `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# required for OpenAI TTS`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`step-2-build-the-autonomous-agent`,children:`Step 2: Build the autonomous agent`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`13`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` swarms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Terminal-Agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Agent that can plan tasks and run bash commands on the terminal\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-sonnet-4-5\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` dynamic_temperature_enabled`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` max_loops`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"auto\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` dynamic_context_window`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` selected_tools`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"all\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` top_p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` streaming_on`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# the callback only receives tokens when the agent streams`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`max_loops=\"auto\"`}),` runs the agent through three phases — plan, execute, summary — looping until it decides the task is done. `,_jsx(_components.code,{children:`selected_tools=\"all\"`}),` (the default) exposes every tool the autonomous looper has access to (bash, file ops, etc.). `,_jsx(_components.code,{children:`streaming_on=True`}),` is what makes the model stream, so the TTS callback receives tokens.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-3-wire-up-the-streaming-tts-callback`,children:`Step 3: Wire up the streaming TTS callback`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` voice_agents `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` StreamingTTSCallback`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# voice options: alloy, echo, fable, onyx, nova, shimmer`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tts_callback `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` StreamingTTSCallback(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`voice`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"alloy\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tts-1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`step-4-run-the-agent`,children:`Step 4: Run the agent`}),`\n`,_jsxs(_components.p,{children:[`The TTS callback receives tokens from `,_jsx(_components.strong,{children:`every`}),` phase of the autonomous loop — the planning step, each tool-call/synthesis turn, and the final summary.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` __name__`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"__main__\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.run(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` task`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Use the terminal to list the current directory, and see what files are in it.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` streaming_callback`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tts_callback,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Flush so the last sentence is spoken`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tts_callback.flush()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(result)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`full-example`,children:`Full example`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`26`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`26`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` swarms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` voice_agents `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` StreamingTTSCallback`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Terminal-Agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Agent that can plan tasks and run bash commands on the terminal\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-sonnet-4-5\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` dynamic_temperature_enabled`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` max_loops`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"auto\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` dynamic_context_window`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` selected_tools`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"all\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` top_p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` streaming_on`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tts_callback `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` StreamingTTSCallback(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`voice`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"alloy\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tts-1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` __name__`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"__main__\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.run(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` task`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Use the terminal to list the current directory, and see what files are in it.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` streaming_callback`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tts_callback,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tts_callback.flush()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(result)`})]}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`An autonomous agent with `,_jsx(_components.code,{children:`selected_tools=\"all\"`}),` can execute bash commands. Run it inside a sandbox or scoped working directory if the task is untrusted.`]})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`Source: `,_jsx(_components.a,{href:`https://github.com/kyegomez/swarms/blob/master/examples/guides/voice_agents/voice_agents_examples/run_auto_agent_with_speech.py`,children:`examples/guides/voice_agents/voice_agents_examples/run_auto_agent_with_speech.py`})]})}),`\n`,_jsx(Heading,{level:`2`,id:`see-also`,children:`See also`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/examples/voice-agents/agent-with-streaming-speech`,children:`Streaming Voice Agent`}),` — same callback pattern with a single-loop agent.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/examples/voice-agents/hierarchical-speech-swarm`,children:`Hierarchical Speech Swarm`}),` — multi-agent voice differentiation.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Autonomous Voice Agent","description":"An autonomous (max_loops=\"auto\") agent with terminal access that narrates its plan, tool use, and final summary in real time.","icon":"robot","href":"/examples/voice-agents/autonomous-agent-with-speech"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Step 1: Install dependencies","slug":"step-1-install-dependencies","depth":2,"children":[]},{"title":"Step 2: Build the autonomous agent","slug":"step-2-build-the-autonomous-agent","depth":2,"children":[]},{"title":"Step 3: Wire up the streaming TTS callback","slug":"step-3-wire-up-the-streaming-tts-callback","depth":2,"children":[]},{"title":"Step 4: Run the agent","slug":"step-4-run-the-agent","depth":2,"children":[]},{"title":"Full example","slug":"full-example","depth":2,"children":[]},{"title":"See also","slug":"see-also","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"kyegomez-swarms-97","siteName":"swarms","title":"Autonomous Voice Agent - swarms","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-03T00:14:28.924Z","originalFileLocation":"examples/voice-agents/autonomous-agent-with-speech.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"An autonomous (max_loops=\u0026quot;auto\u0026quot;) agent with terminal access that narrates its plan, tool use, and final summary in real time.\">\u003cmeta data-mint-head name=\"application-name\" content=\"swarms\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Autonomous Voice Agent - swarms\">\u003cmeta data-mint-head property=\"og:description\" content=\"An autonomous (max_loops=\u0026quot;auto\u0026quot;) agent with terminal access that narrates its plan, tool use, and final summary in real time.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"swarms\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://kyegomez-swarms-97.mintlify.app/_mintlify/api/og/v2?division=Voice+Agents\u0026amp;title=Autonomous+Voice+Agent\u0026amp;description=An+autonomous+%28max_loops%3D%22auto%22%29+agent+with+terminal+access+that+narrates+its+plan%2C+tool+use%2C+and+final+summary+in+real+time.\u0026amp;theme=5153e5700b995bc72eadb0da\u0026amp;signature=01545b8c967ccd7bdff864c633eda0ab22fcd0520697c1ab65526b1f7dc4197e\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Autonomous Voice Agent - swarms\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"An autonomous (max_loops=\u0026quot;auto\u0026quot;) agent with terminal access that narrates its plan, tool use, and final summary in real time.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://kyegomez-swarms-97.mintlify.app/_mintlify/api/og/v2?division=Voice+Agents\u0026amp;title=Autonomous+Voice+Agent\u0026amp;description=An+autonomous+%28max_loops%3D%22auto%22%29+agent+with+terminal+access+that+narrates+its+plan%2C+tool+use%2C+and+final+summary+in+real+time.\u0026amp;theme=5153e5700b995bc72eadb0da\u0026amp;signature=01545b8c967ccd7bdff864c633eda0ab22fcd0520697c1ab65526b1f7dc4197e\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"swarms\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#DC2626\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/examples/voice-agents/autonomous-agent-with-speech.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.swarms.world/#organization\",\"name\":\"swarms\",\"url\":\"https://docs.swarms.world\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/light.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=e3d664b8b8f6928c836776b54704d076\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.swarms.world#website\",\"name\":\"swarms\",\"url\":\"https://docs.swarms.world\",\"publisher\":{\"@id\":\"https://docs.swarms.world/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech#webpage\",\"url\":\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech\",\"name\":\"Autonomous Voice Agent\",\"description\":\"An autonomous (max_loops=\\\"auto\\\") agent with terminal access that narrates its plan, tool use, and final summary in real time.\",\"dateModified\":\"2026-10-03T00:14:28.924Z\",\"isPartOf\":{\"@id\":\"https://docs.swarms.world#website\"},\"breadcrumb\":{\"@id\":\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Voice Agents\",\"item\":\"https://docs.swarms.world/examples/voice-agents/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Autonomous Voice Agent\",\"item\":\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech#article\",\"headline\":\"Autonomous Voice Agent\",\"name\":\"Autonomous Voice Agent\",\"description\":\"An autonomous (max_loops=\\\"auto\\\") agent with terminal access that narrates its plan, tool use, and final summary in real time.\",\"url\":\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech\",\"mainEntityOfPage\":{\"@id\":\"https://docs.swarms.world/examples/voice-agents/autonomous-agent-with-speech#webpage\"},\"dateModified\":\"2026-10-03T00:14:28.924Z\",\"publisher\":{\"@id\":\"https://docs.swarms.world/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.swarms.world#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"swarms\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"swarms","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api/agent"}]},{"tab":"RouteHub","pages":[{"title":"RouteHub","href":"/routehub/overview"}]},{"tab":"Swarms API","pages":[{"title":"Swarms API","href":"/swarms-api/overview"}]},{"tab":"Examples","groups":[{"group":"Index","pages":[{"title":"Overview","icon":"table-list","href":"/examples/overview"},{"title":"Examples Index","icon":"book","href":"/examples/overviews/examples-index"},{"title":"Swarms Cookbook","icon":"book-open","href":"/examples/overviews/cookbook"},{"title":"Community Resources","icon":"users","href":"/examples/overviews/community-resources"}]},{"group":"Basic Examples","pages":[{"title":"Basic Examples Overview","icon":"graduation-cap","href":"/examples/overviews/basic-overview"},{"title":"Basic Agent","icon":"robot","href":"/examples/basic-agent"},{"title":"Agent with Tools","icon":"wrench","href":"/examples/agent-with-tools"},{"title":"Dynamic Tool Usage","icon":"magnifying-glass-arrow-right","href":"/examples/tools/dynamic-tool-usage"},{"title":"Vision Agent","icon":"eye","href":"/examples/vision-agent"},{"title":"Streaming Responses","icon":"tower-broadcast","href":"/examples/streaming"},{"title":"Agent Streaming","icon":"bolt","href":"/examples/agent-streaming-example"}]},{"group":"Model Providers","pages":[{"title":"Building Agents with Anthropic","icon":"anthropic","href":"/examples/model-providers/anthropic"},{"title":"Building Agents with OpenAI","icon":"openai","href":"/examples/model-providers/openai"},{"title":"Building Agents with Gemini","icon":"google","href":"/examples/model-providers/gemini"},{"title":"Claude Fable 5","icon":"sparkles","href":"/examples/model-providers/claude-fable-5"},{"title":"Building Agents with Groq","icon":"bolt","href":"/examples/model-providers/groq"},{"title":"Building Agents with Cerebras","icon":"gauge-high","href":"/examples/model-providers/cerebras"},{"title":"Building Agents with DeepSeek","icon":"brain","href":"/examples/model-providers/deepseek"},{"title":"Building Agents with xAI (Grok)","icon":"x","href":"/examples/model-providers/xai"},{"title":"Building Agents with Ollama","icon":"house","href":"/examples/model-providers/ollama"},{"title":"Building Agents with vLLM","icon":"server","href":"/examples/model-providers/vllm"},{"title":"Building Agents with OpenRouter","icon":"route","href":"/examples/model-providers/openrouter"},{"title":"OpenRouter Tutorial: Single Agents, Group Chat \u0026 Concurrent Workflows","icon":"route","href":"/examples/model-providers/openrouter-tutorial"},{"title":"Building Agents with Azure OpenAI","icon":"microsoft","href":"/examples/model-providers/azure-openai"}]},{"group":"Single Agent","pages":[{"title":"RAG Examples Overview","icon":"database","href":"/examples/overviews/rag-overview"},{"title":"Agent Streaming","icon":"wave-pulse","href":"/examples/agents/agent-streaming"},{"title":"Advanced Research","icon":"flask","href":"/examples/agents/advanced-research"},{"title":"Autonomous Looper with Bash","icon":"terminal","href":"/examples/agents/autonomous-looper-bash"},{"title":"Autonomous Looper with Tools","icon":"screwdriver-wrench","href":"/examples/agents/autonomous-looper-tools"},{"title":"Persistent Memory","icon":"database","href":"/examples/agents/persistent-memory"},{"title":"Context Compression","icon":"compress","href":"/examples/agents/context-compression"},{"title":"Prompt Caching","icon":"database","href":"/examples/agents/prompt-caching"}]},{"group":"Tree of Thoughts","pages":[{"title":"Number theory with a BFS beam","icon":"calculator","href":"/examples/tree-of-thoughts/number-theory-counting"},{"title":"Fermi estimate with sampling and votes","icon":"bolt","href":"/examples/tree-of-thoughts/fermi-estimation"},{"title":"Knights and knaves with DFS","icon":"chess-knight","href":"/examples/tree-of-thoughts/knights-and-knaves"}]},{"group":"Multi-Agent Examples","pages":[{"title":"Multi-Agent Architectures Overview","icon":"sitemap","href":"/examples/overviews/multi-agent-overview"},{"title":"Sequential Workflow Example","href":"/examples/sequential-workflow-example"},{"title":"Sequential Workflow Streaming","icon":"arrow-right-arrow-left","href":"/examples/sequential-workflow-streaming-example"},{"title":"Concurrent Workflow Example","href":"/examples/concurrent-workflow-example"},{"title":"Mixture of Agents (MoA) Example","href":"/examples/mixture-of-agents-example"},{"title":"Hierarchical Swarm Example","href":"/examples/hierarchical-swarm-example"},{"title":"Group Chat Example","href":"/examples/group-chat-example"},{"title":"Swarm Router Example","href":"/examples/swarm-router-example"},{"title":"Advisor Swarm Example","href":"/examples/multi-agent/advisor-swarm-example"},{"title":"Debate Swarm Quickstart","icon":"comments","href":"/examples/multi-agent/debate-quickstart"},{"title":"Social Swarm Patterns","icon":"diagram-project","href":"/examples/social-swarm-patterns"}]},{"group":"Auto Agent Builder","pages":[{"title":"Auto Agent Builder Quickstart","icon":"wand-magic-sparkles","href":"/examples/auto-agent-builder/quickstart"},{"title":"Dynamic Support Triage","icon":"headset","href":"/examples/auto-agent-builder/triage"},{"title":"Reproducible Rosters","icon":"lock","href":"/examples/auto-agent-builder/reproducible"}]},{"group":"Scheduled Agents","pages":[{"title":"CronJob Quickstart","icon":"clock","href":"/examples/cron-job/quickstart"},{"title":"Multiple Agents on Different Schedules","icon":"layer-group","href":"/examples/cron-job/multiple-agents"},{"title":"Failure Handling and Monitoring","icon":"shield-halved","href":"/examples/cron-job/resilience"}]},{"group":"Applications","pages":[{"title":"Applications Overview","icon":"rectangle-list","href":"/examples/overviews/applications-overview"},{"title":"Apps Overview","icon":"grid","href":"/examples/overviews/apps-overview"},{"title":"Paper Implementations","icon":"scroll","href":"/examples/overviews/paper-implementations"},{"title":"Templates \u0026 Applications","icon":"layer-group","href":"/examples/overviews/templates"},{"title":"Marketing Team Swarm","icon":"bullhorn","href":"/examples/applications/marketing-team"},{"title":"Hiring Swarm","icon":"user-tie","href":"/examples/applications/hiring-swarm"},{"title":"Job Finding Swarm","icon":"briefcase","href":"/examples/applications/job-finding"},{"title":"M\u0026A Swarm","icon":"handshake","href":"/examples/applications/ma-swarm"},{"title":"Real Estate Swarm","icon":"house","href":"/examples/applications/realestate-swarm"},{"title":"Smart Database Swarm","icon":"database","href":"/examples/applications/smart-database"}]},{"group":"Research","pages":[{"title":"Can AI Agents Agree?","icon":"people-arrows","href":"/examples/research/can_agents_agree"},{"title":"Open Agent Bazaar","icon":"store","href":"/examples/research/open_agent_bazaar"}]},{"group":"Technical Analysis","pages":[{"title":"GroupChat Internals: A Technical Analysis","icon":"diagram-project","href":"/examples/groupchat_insight"}]},{"group":"Use Cases","pages":[{"title":"Research Team Swarm","icon":"microscope","href":"/examples/use-cases/research-team"},{"title":"Content Creation Pipeline","icon":"pen-nib","href":"/examples/use-cases/content-creation"},{"title":"Data Analysis Swarm","icon":"chart-line","href":"/examples/use-cases/data-analysis"}]},{"group":"Finance","pages":[{"title":"Gold ETF Research","icon":"coins","href":"/examples/applications/gold-etf-research"},{"title":"Financial Analysis System","icon":"chart-pie","href":"/examples/use-cases/financial-analysis"},{"title":"Agentic Trading with Gemini","icon":"robot","href":"/examples/finance/agentic-trading-gemini"},{"title":"Prediction Markets: Polymarket","icon":"scale-balanced","href":"/examples/finance/prediction-markets-polymarket"},{"title":"Prediction Markets: Kalshi","icon":"scale-balanced","href":"/examples/finance/prediction-markets-kalshi"}]},{"group":"Voice Agents","pages":[{"title":"Voice Agents Overview","icon":"microphone","href":"/examples/voice-agents/overview"},{"title":"Basic Speech Agent","icon":"volume-high","href":"/examples/voice-agents/agent-speech"},{"title":"Streaming Voice Agent","description":"Speak each sentence the moment the LLM produces it using StreamingTTSCallback.","icon":"tower-broadcast","href":"/examples/voice-agents/agent-with-streaming-speech"},{"title":"Autonomous Voice Agent","icon":"robot","href":"/examples/voice-agents/autonomous-agent-with-speech"},{"title":"Voice Debate","description":"Two agents debate turn-by-turn, each speaking with a distinct voice. Optional speech-to-text input for the opening prompt.","icon":"comments","href":"/examples/voice-agents/debate-with-speech"},{"title":"Hierarchical Speech Swarm","icon":"sitemap","href":"/examples/voice-agents/hierarchical-speech-swarm"}]},{"group":"Integrations","pages":[{"title":"Tools \u0026 Integrations Overview","icon":"puzzle-piece","href":"/examples/overviews/tools-overview"},{"title":"Web Search with Exa","icon":"magnifying-glass","href":"/examples/integrations/exa-search"},{"title":"Browser Use","icon":"globe","href":"/examples/integrations/browser-use"},{"title":"MCP Server and Client","icon":"plug","href":"/examples/integrations/mcp-datastax"},{"title":"x402 Discovery Query","icon":"satellite-dish","href":"/examples/integrations/x402-discovery"},{"title":"x402 Payment Integration","icon":"credit-card","href":"/examples/integrations/x402-payment"},{"title":"Firecrawl Tool","icon":"fire","href":"/examples/integrations/firecrawl"},{"title":"Web Scraper Agents","icon":"spider","href":"/examples/integrations/web-scraper-agents"}]},{"group":"MCP Tool Integrations","pages":[{"title":"MCP examples overview","icon":"plug","href":"/examples/mcp/overview"},{"title":"DeepWiki: repo Q\u0026A","icon":"book","href":"/examples/mcp/deepwiki-repo-qa"},{"title":"GitMCP: one-repo docs bot","icon":"github","href":"/examples/mcp/gitmcp-repo-docs"},{"title":"Microsoft Learn: grounded answers","icon":"microsoft","href":"/examples/mcp/microsoft-learn-docs"},{"title":"Exa: live web search","icon":"magnifying-glass","href":"/examples/mcp/exa-web-search"},{"title":"Firecrawl: scrape pages to markdown","icon":"fire","href":"/examples/mcp/firecrawl-web-scraping"},{"title":"Hugging Face: find models","icon":"face-smile","href":"/examples/mcp/huggingface-model-search"},{"title":"Semgrep: security review","icon":"shield-halved","href":"/examples/mcp/semgrep-security-scan"},{"title":"Several servers at once","icon":"layer-group","href":"/examples/mcp/multi-server-agent"},{"title":"Serve an agent over MCP","icon":"rocket","href":"/examples/mcp/mcp-deployer-serve-agent"},{"title":"Serve a team of agents from one MCP server","icon":"users","href":"/examples/mcp/mcp-deployer-serve-team"},{"title":"MCP in a multi-agent workflow","icon":"diagram-project","href":"/examples/mcp/sequential-workflow"},{"title":"Dynamic tool loading","icon":"bolt","href":"/examples/mcp/dynamic-tool-loading"},{"title":"Authentication patterns","icon":"key","href":"/examples/mcp/authentication"},{"title":"Build your own MCP server","icon":"server","href":"/examples/mcp/local-server"}]},{"group":"Deployment","pages":[{"title":"Deployment Solutions Overview","icon":"cloud-arrow-up","href":"/examples/deployment-overview"},{"title":"FastAPI Agent API","icon":"server","href":"/examples/fastapi-agent-api"},{"title":"Google Cloud Run","icon":"cloud","href":"/examples/cloud-run"},{"title":"Cloudflare Workers","icon":"cloudflare","href":"/examples/cloudflare-workers"},{"title":"Phala TEE Deployment","icon":"shield-halved","href":"/examples/phala-deploy"}]},{"group":"CLI","pages":[{"title":"CLI Guides Overview","icon":"terminal","href":"/examples/overviews/cli-overview"},{"title":"CLI Quickstart Tutorial","icon":"rocket","href":"/examples/cli/quickstart-tutorial"},{"title":"Chat Command","icon":"message","href":"/examples/cli/chat-command"},{"title":"Multi-Agent CLI Quickstart","icon":"rocket","href":"/examples/cli/multi-agent-quickstart"}]}]},{"tab":"Community","pages":[{"title":"Community","href":"/community/contributing"}]}]},"basePath":"","title":"Autonomous Voice Agent - swarms","buildId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","deploymentId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","dynamics":[],"chunks":[]}