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

# Quickstart

> Get started with Composio SDK in TypeScript or Python

## Installation

Get started with Composio by installing the SDK for your preferred language.

<Tabs>
  <Tab title="TypeScript">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @composio/core
      ```

      ```bash yarn theme={null}
      yarn add @composio/core
      ```

      ```bash pnpm theme={null}
      pnpm add @composio/core
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Python">
    <CodeGroup>
      ```bash pip theme={null}
      pip install composio
      ```

      ```bash poetry theme={null}
      poetry add composio
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Initialize Composio

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Composio } from '@composio/core';

    // Initialize the SDK
    const composio = new Composio({
      // apiKey: 'your-api-key',
    });
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from composio import Composio

    composio = Composio(
      # api_key="your-api-key",
    )
    ```
  </Tab>
</Tabs>

## Build Your First Agent

Create a simple agent that can fetch the latest Hacker News posts using OpenAI Agents.

<Steps>
  <Step title="Install OpenAI Agents Provider">
    <Tabs>
      <Tab title="TypeScript">
        ```bash theme={null}
        npm install @composio/openai-agents @openai/agents
        ```
      </Tab>

      <Tab title="Python">
        ```bash theme={null}
        pip install composio_openai_agents openai-agents
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Initialize Composio with Provider">
    <Tabs>
      <Tab title="TypeScript">
        ```typescript theme={null}
        import { Composio } from '@composio/core';
        import { OpenAIAgentsProvider } from '@composio/openai-agents';
        import { Agent, run } from '@openai/agents';

        const composio = new Composio({
          provider: new OpenAIAgentsProvider(),
        });

        const userId = 'user@acme.org';
        ```
      </Tab>

      <Tab title="Python">
        ```python theme={null}
        import asyncio
        from agents import Agent, Runner
        from composio import Composio
        from composio_openai_agents import OpenAIAgentsProvider

        # Initialize Composio client with OpenAI Agents Provider
        composio = Composio(provider=OpenAIAgentsProvider())

        user_id = "user@acme.org"
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Get Tools from a Toolkit">
    <Tabs>
      <Tab title="TypeScript">
        ```typescript theme={null}
        const tools = await composio.tools.get(userId, {
          toolkits: ['HACKERNEWS'],
        });
        ```
      </Tab>

      <Tab title="Python">
        ```python theme={null}
        tools = composio.tools.get(user_id=user_id, toolkits=["HACKERNEWS"])
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Create and Run Your Agent">
    <Tabs>
      <Tab title="TypeScript">
        ```typescript theme={null}
        const agent = new Agent({
          name: 'Hackernews assistant',
          tools: tools,
        });

        const result = await run(agent, 'What is the latest hackernews post about?');

        console.log(JSON.stringify(result.finalOutput, null, 2));
        // will return the response from the agent with data from HACKERNEWS API.
        ```
      </Tab>

      <Tab title="Python">
        ```python theme={null}
        # Create an agent with the tools
        agent = Agent(
            name="Hackernews Agent",
            instructions="You are a helpful assistant.",
            tools=tools,
        )

        # Run the agent
        async def main():
            result = await Runner.run(
                starting_agent=agent,
                input="What's the latest Hackernews post about?",
            )
            print(result.final_output)

        asyncio.run(main())
        # will return the response from the agent with data from HACKERNEWS API.
        ```
      </Tab>
    </Tabs>
  </Step>
</Steps>

## Complete Example

Here's the full code to get you started:

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Composio } from '@composio/core';
    import { OpenAIAgentsProvider } from '@composio/openai-agents';
    import { Agent, run } from '@openai/agents';

    const composio = new Composio({
      provider: new OpenAIAgentsProvider(),
    });

    const userId = 'user@acme.org';

    const tools = await composio.tools.get(userId, {
      toolkits: ['HACKERNEWS'],
    });

    const agent = new Agent({
      name: 'Hackernews assistant',
      tools: tools,
    });

    const result = await run(agent, 'What is the latest hackernews post about?');

    console.log(JSON.stringify(result.finalOutput, null, 2));
    // will return the response from the agent with data from HACKERNEWS API.
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import asyncio
    from agents import Agent, Runner
    from composio import Composio
    from composio_openai_agents import OpenAIAgentsProvider

    # Initialize Composio client with OpenAI Agents Provider
    composio = Composio(provider=OpenAIAgentsProvider())

    user_id = "user@acme.org"
    tools = composio.tools.get(user_id=user_id, toolkits=["HACKERNEWS"])

    # Create an agent with the tools
    agent = Agent(
        name="Hackernews Agent",
        instructions="You are a helpful assistant.",
        tools=tools,
    )

    # Run the agent
    async def main():
        result = await Runner.run(
            starting_agent=agent,
            input="What's the latest Hackernews post about?",
        )
        print(result.final_output)

    asyncio.run(main())
    # will return the response from the agent with data from HACKERNEWS API.
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="Explore Toolkits" icon="toolbox" href="/concepts/toolkits">
    Browse 1000+ available toolkits and integrations
  </Card>

  <Card title="Authentication" icon="key" href="/concepts/authentication">
    Learn how to connect user accounts to external services
  </Card>

  <Card title="AI Providers" icon="brain" href="/concepts/providers">
    Integrate with OpenAI, Anthropic, LangChain, and more
  </Card>

  <Card title="Custom Tools" icon="hammer" href="/concepts/custom-tools">
    Create your own custom tools and actions
  </Card>
</CardGroup>
