🏠
Toolhouse
DiscordGithubSign upGo to App
  • 🏠Toolhouse
  • Quick start: deploy your first agent
  • Build agents with the th file
  • Test agents before deploying
  • Deploy and run your agents
  • Agent workers
    • Running Agents asynchronously
      • API Reference
    • Schedule autonomous runs
      • API Reference
  • Toolhouse SDK
    • ✨Quick start (Python)
    • ✨Quick start (TypeScript)
    • Using LlamaIndex
    • Using Vercel AI
  • Choose MCP servers for your agent
  • Customize agents for your end users
  • 💬Execution logs
  • Go to app
Powered by GitBook
On this page
  • Initial setup
  • Step 0: Create your th file
  • Step 1: Test your agent
  • Step 2: Deploy your agent

Quick start: deploy your first agent

This guide will show you how to creating and deploy a new agent using the th command line interface.

Initial setup

The CLI will need a Toolhouse API key. Type th login to automatically get one. This command will open your default browser and ask you to log into Toolhouse or create a new account, if you haven't done so already.

Note: you will only need to run this command once.

th login

Your API Key will be stored in the ~/.toolhouse file.

Other ways to login

As an alternative you can pass an API Key by doing one of these actions:

  • Manually create a ~/.toolhouse file and add TOOLHOUSE_API_KEY=(your API Key)

  • Set a TOOLHOUSE_API_KEY environment variable with your API Key.

Step 0: Create your th file

You can now create a Toolhouse agent file, or th file for short. A th file is a YAML file containing the setup for your agent. Type th new to create a new agent file:

th new hello

The CLI will create a hello.yaml file in your current folder.

Step 1: Test your agent

You can test your agent by running it via th run.

th run

Running the agent will show the configuration parameters and will stream any MCP server calls and the final output. You can change the th file and run th run again to see new results.

Once you're happy with the results, you can deploy your agent.

Step 2: Deploy your agent

You can deploy your agent by typing th deploy. You agent will be deployed as an API with its own unique URL:

th deploy

You will receive a URL similar to this:

https://agents.toolhouse.ai/a1d93c2e-7013-4cea-b857-a27980a52ba2

You can simply call your agent as an HTTP POST request, and it will stream the response using the configuration from your th file.

curl -XPOST "https://agents.toolhouse.ai/a1d93c2e-7013-4cea-b857-a27980a52ba2
// Remember to run npm i fetch-event-stream
import { events, stream } from 'fetch-event-stream';

const agent = 'https://agents.toolhouse.ai/a1d93c2e-7013-4cea-b857-a27980a52ba2';

const abort = new AbortController();
const response = await fetch(agent, { method: 'POST' });

if (response.ok) {
  const stream = events(res, abort.signal);
  for await (let event of stream) {
    console.log('<<', event.data);
  }
}
import httpx
import asyncio

agent_url = 'https://agents.toolhouse.ai/a1d93c2e-7013-4cea-b857-a27980a52ba2'

async def main():
    async with httpx.AsyncClient() as client:
        async with client.stream('POST', agent_url) as response:
            if response.status_code == 200:
                async for chunk in response.aiter_lines():
                    print('<<', chunk)

asyncio.run(main())
import requests

agent = 'https://agents.toolhouse.ai/a1d93c2e-7013-4cea-b857-a27980a52ba2'

response = requests.post(agent, stream=True)
response.raise_for_status()

for line in response.iter_lines(decode_unicode=True):
    if line:
        print('<<', line)

Agents are public on the Free plan

Free plan users can only create public agents.

Pro users can set the visibility of their agents to Private before deploying.

PreviousToolhouseNextBuild agents with the th file

Last updated 6 days ago

Learn more