Use existing agents from your workspace.
Basic Usage
python
1from inferencesh import inference23client = inference(api_key="inf_your_key")45# Reference by namespace/name@version6agent = client.agent("my-team/support-agent@latest")78# Send a message9response = agent.send_message("Hello!")10print(response.text)Agent Reference Formats
python
1# Latest version2agent = client.agent("namespace/agent-name@latest")34# Specific version5agent = client.agent("namespace/agent-name@abc123")67# By ID8agent = client.agent_by_id("agent_id_here")Multi-turn Conversations
State is maintained automatically:
python
1agent = client.agent("my-team/support-agent@latest")23response1 = agent.send_message("What's my account status?")4print(response1.text)56response2 = agent.send_message("Can you explain that more?")7print(response2.text) # Has context from previous messageReset Conversation
Start a new conversation:
python
1agent.reset()23response = agent.send_message("Start fresh!")Get Chat History
python
1chat = agent.get_chat()23for message in chat["messages"]:4 print(f"{message['role']}: {message['content']}")Stop Active Response
python
1# Start streaming2for chunk in agent.send_message("Tell me a story", stream=True):3 if should_stop:4 agent.stop()5 break6 print(chunk.text)