> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dynamic Tools

> Add or remove tools dynamically based on runtime dependencies.

Dynamic Tools.

```python theme={null}
"""
Dynamic Tools
=============================

Dynamic Tools.
"""

from datetime import datetime

from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.run import RunContext


def get_runtime_tools(run_context: RunContext):
    """Return tools dynamically based on session state."""

    def get_time() -> str:
        return datetime.utcnow().isoformat()

    def get_project() -> str:
        project = (run_context.session_state or {}).get("project", "unknown")
        return f"Current project: {project}"

    return [get_time, get_project]


# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
    name="Dynamic Tools Agent",
    model=OpenAIResponses(id="gpt-5.2"),
    tools=get_runtime_tools,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response(
        "Use available tools to report current context.",
        session_state={"project": "cookbook-restructure"},
        stream=True,
    )
```

## Run the Example

```bash theme={null}
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/02_agents/15_dependencies

# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate

python dynamic_tools.py
```
