Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Tools can receive agent context (session ID, agent ID, etc.) without exposing these parameters in the public schema.
Quick Start
from praisonaiagents import Agent, tool
from praisonaiagents import Injected
@tool
def show_context(query: str, state: Injected[dict]) -> str:
"""Tool with injected state."""
session = state.get('session_id')
return f"Query: {query}, Session: {session}"
agent = Agent(
name="Bot",
instructions="Helper",
tools=[show_context],
memory={"session_id": "my-session"}
)
# 'state' is NOT in the tool schema - only 'query' is visible
result = agent.execute_tool("show_context", {"query": "test"})
Injected Types
from praisonaiagents import Injected
from praisonaiagents.tools.injected import AgentState
# Dict injection
state: Injected[dict]
# AgentState injection
state: Injected[AgentState]
AgentState Fields
| Field | Description |
|---|
agent_id | Current agent name |
run_id | Current run ID |
session_id | Session identifier |
last_user_message | Last user message |
metadata | Additional metadata |
Manual Context
from praisonaiagents.tools.injected import AgentState, with_injection_context
state = AgentState(agent_id="a", run_id="r", session_id="s")
with with_injection_context(state):
result = my_tool(query="test")