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

# Just-in-Time Context

> Provide context to your agents to manage a call

Provide context to your agent at creation time just before a call.
This enables them to manage the call more effectively.

## Use Cases

Just-in-time context enables you to:

* **Tailored User Experience**: Generate unique system prompts based on user data
* **Session-Specific Configuration**: Create specialized agents for individual sessions
* **Context Augmentation**: Adapt agent behavior based on external data sources

## Implementation

You can provide just-in-time context in the system prompt field of the [Create Agent endpoint](/api-reference/agents/create-agent).
Since agent creation is a lightweight operation, you can generate agents dynamically just before a call to inject just-in-time context.

The response includes the agent ID, which you can use to share as a direct link (`https://bey.chat/{agent-id}`) or [embed via iframe](/integrations/managed-agents/iframe-embedding).

Agents created this way are typically single-use and disposable.
To keep your agent collection clean, delete them after use with the [Delete Agent endpoint](/api-reference/agents/delete-agent).
Conversations managed by these agents remain in your database.

<Info>
  Creating single-use agents for just-in-time context is a simple workaround.
  We plan to directly support dynamic context injection for agents in the future.
</Info>

## Complete Example

See our [just-in-time context example](https://github.com/bey-dev/bey-examples/tree/main/e2e-agent#readme) for full implementation including API integration, context injection, and call data retrieval.

## Next Steps

<CardGroup cols={2}>
  <Card title="Just-in-Time Context Example" icon="github" href="https://github.com/bey-dev/bey-examples/tree/main/e2e-agent#readme">
    Complete implementation with code examples
  </Card>

  <Card title="Create Agent API" icon="code" href="/api-reference/agents/create-agent">
    API reference for creating agents programmatically
  </Card>

  <Card title="Back to Managed Agents" icon="arrow-left" href="/integrations/managed-agents">
    Return to managed agents overview
  </Card>
</CardGroup>
