Skip to content
1Claw Academy
Curriculum/Integrations & Ecosystem3 minIntermediate · Lesson 8 of 11

Give a CrewAI crew secure secret access

Use the 1claw-crewai-tools package so a CrewAI agent fetches a secret at runtime.

The 1claw-crewai-tools package adds an OneclawVaultTool that fetches credentials from your vault at runtime using a scoped agent identity. Secrets are not copied into prompts, repos, or long-lived memory.

Concept

The PyPI distribution name is 1claw-crewai-tools. The Python import package is oneclaw_crewai. You also need an agent bound to a vault with a read policy on the secret path, plus an LLM key. Requires an agent with a read policy on the secret path. See the Agents & Access Control track for setup.

  1. 1

    Install the tools package and CrewAI.

    bash
    pip install 1claw-crewai-tools crewai
  2. 2

    Export the agent identity, vault, and an LLM key. Use values from agent creation (see Agents & Access Control track) and your vault UUID from 1claw vault list.

    bash
    export ONECLAW_AGENT_ID="paste-your-agent-uuid-here"
    export ONECLAW_AGENT_API_KEY="ocv_paste_your_agent_key_here"
    export ONECLAW_VAULT_ID="paste-your-vault-uuid-here"
    export GOOGLE_API_KEY="your-gemini-key"
  3. 3

    Build a crew that gives one agent the vault tool. Save the script as crew_demo.py.

    python
    import os
    from crewai import Agent, Crew, Process, Task
    from oneclaw_crewai import OneclawVaultTool
    
    vault_tool = OneclawVaultTool(
        agent_id=os.environ["ONECLAW_AGENT_ID"],
        api_key=os.environ["ONECLAW_AGENT_API_KEY"],
        vault_id=os.environ["ONECLAW_VAULT_ID"],
    )
    
    agent = Agent(
        role="Engineer",
        goal="Build features using vault-stored API keys",
        backstory="You use tools instead of pasted secrets.",
        tools=[vault_tool],
        verbose=False,
    )
    
    task = Task(
        description="Read path api-keys/openai using the vault tool; do not echo raw values.",
        expected_output="Confirmation that the path was read.",
        agent=agent,
    )
    
    crew = Crew(agents=[agent], tasks=[task], process=Process.sequential)
    crew.kickoff()
  4. 4

    Create the secret if it doesn't already exist.

    bash
    1claw secret set api-keys/openai --vault $ONECLAW_VAULT_ID --value 'your-openai-key' --type api_key
  5. 5

    Run the crew.

    bash
    python crew_demo.py
Watch out

Keep verbose=False in production. With verbose=True, CrewAI logs the raw return value of every tool call, which prints secret values to stdout. Never print or log the tool return value.

Your crew now fetches a secret from 1Claw through the oneclaw_vault tool during a task, without the value ever landing in code or repo.

What this gives you, and what it does not. Multi-agent frameworks multiply the surface, because every agent in the crew inherits whatever the crew's tools can reach.

  • Tools are usually shared across the crew. An agent added later for an unrelated job often gets the whole toolset by default, including the vault access the first one needed.
  • One agent's output becomes another's input, and it should be treated as untrusted. A researcher reading the web feeds text to a summariser, and that text can carry instructions.
  • Cascading failure is the characteristic multi-agent bug. An early error is treated as established fact by every downstream step, which is why it appears in the OWASP agentic list as its own category.
Watch out

Give each crew member the narrowest toolset that lets it do its job, even when the framework makes sharing the default. The convenience of a shared toolset is exactly the excessive-functionality root cause.

Decide

A three-agent crew shares one toolset because the framework makes that the default. You add a fourth agent to draft customer emails, and it inherits vault access it has no use for.

What is the right response?

Check your understanding

3 questions
1

What is the import package name for the CrewAI tools?

2

Why should verbose stay False in production?

3

How are the vault credentials retrieved?