Skip to main content
This quickstart will guide you through building a simple chat agent that can use your tools.
1
Setup your project in chat-with-tools.
2
Write your first Agentica agent.

Installation

We’ll setup our project in a new directory called chat-with-tools.
Get your API key from the login page.
Prerequisites:
  • Python version 3.12.*
  • uv package manager
  • Your Agentica API key from the login page
Setup your virtual environment
uv init chat-with-tools --python '==3.12.*'
cd chat-with-tools
uv sync
source .venv/bin/activate
uv add symbolica-agentica
Export your API key under the AGENTICA_API_KEY environment variable.
export AGENTICA_API_KEY="your-key-here"
Then, start editing your main.py file.

Your First Agent

main.py
import asyncio
from agentica import spawn
from agentica.logging import set_default_agent_listener
from agentica.logging.loggers import StreamLogger

set_default_agent_listener(None)

# Define your tools here!
def my_tool(arg: str) -> str:
    """Describe what your tool does."""
    return f"Result for: {arg}"

async def main():
    agent = await spawn(premise="You are a helpful assistant.")

    print("Agent ready! Type 'quit' to exit.\n")

    while True:
        user_input = input("You: ")
        if user_input.lower() == "quit":
            break

        # Stream the agent's response
        stream = StreamLogger()
        with stream:
            result = asyncio.create_task(
                agent.call(str, user_input, my_tool=my_tool)  # Pass your tools here
            )

        async for chunk in stream:
            if chunk.role == "agent":
                print(chunk, end="", flush=True)
        print()

        print(f"Agent: {await result}\n")

if __name__ == "__main__":
    asyncio.run(main())
Now, run your script:
uv run main.py
What just happened?
  • We spawned an agent with a premise describing its role.
  • The StreamLogger lets us stream the agent’s thinking as it runs.
  • We passed tools to agent.call() — the agent automatically decides when to use them.
  • The agent maintains conversation history, so it remembers context across messages.