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

# Agent • AI Agent SDK

> Agent: Create an agent with session context.

# Agent

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**Session**](../classes/Session) class in the [**session**](../modules/session) module.

Create an agent with session context.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: Agent"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def Agent(name: str, role: str, instructions: Optional[str], tools: Optional[List[Any]], memory: bool, knowledge: Optional[List[str]]) -> Agent
```

## Parameters

<ParamField query="name" type="str" required={true}>
  Agent name
</ParamField>

<ParamField query="role" type="str" required={false} default="'Assistant'">
  Agent role
</ParamField>

<ParamField query="instructions" type="Optional" required={false}>
  Agent instructions
</ParamField>

<ParamField query="tools" type="Optional" required={false}>
  List of tools for the agent
</ParamField>

<ParamField query="memory" type="bool" required={false} default="True">
  Enable memory for the agent
</ParamField>

<ParamField query="knowledge" type="Optional" required={false}>
  Knowledge sources for the agent \*\*kwargs: Additional agent parameters
</ParamField>

### Returns

<ResponseField name="Returns" type="Agent">
  Configured Agent instance
</ResponseField>

### Exceptions

<AccordionGroup>
  <Accordion title="ValueError">
    If this is a remote session (use chat() instead)
  </Accordion>
</AccordionGroup>

## Uses

* `ValueError`
* `Agent`

## Used By

* [`ContextAgent.analyze_codebase_with_gitingest`](../functions/ContextAgent-analyze_codebase_with_gitingest)
* [`ContextAgent.perform_ast_analysis`](../functions/ContextAgent-perform_ast_analysis)
* [`ContextAgent.extract_implementation_patterns`](../functions/ContextAgent-extract_implementation_patterns)
* [`ContextAgent.analyze_test_patterns`](../functions/ContextAgent-analyze_test_patterns)
* [`ContextAgent.generate_comprehensive_prp`](../functions/ContextAgent-generate_comprehensive_prp)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/session.py#L133">
  `praisonaiagents/session.py` at line 133
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agents Concept" icon="robot" href="/docs/concepts/agents" />

  <Card title="Single Agent Guide" icon="book-open" href="/docs/guides/single-agent" />

  <Card title="Multi-Agent Guide" icon="users" href="/docs/guides/multi-agent" />

  <Card title="Agent Configuration" icon="gear" href="/docs/configuration/agent-config" />

  <Card title="Auto Agents" icon="wand-magic-sparkles" href="/docs/features/autoagents" />
</CardGroup>
