Spaces:
No application file
No application file
๐ก How to Launch Your First Sandbox with AgentBox
#1
by
agentbox-master - opened
When working with AI models, you often need a quick, secure, and isolated environment to run experiments, test prompts, fine-tune logic, or integrate multiple models together.
AgentBox provides exactly that โ a cloud-based sandbox designed for AI developers.
๐ What is AgentBox?
AgentBox is a developer-oriented AI sandbox platform where you can:
- Run and test LLMs with no local setup
- Prototype agents and toolchains
- Safely experiment in an isolated runtime
- Avoid dependency conflicts on your machine
๐ค Why combine Hugging Face + AgentBox?
You can discover a model on Hugging Face and immediately try it inside AgentBox โ no configuration, GPU drivers, or dependency setup required.
โ Getting Started (in 3 steps)
- Visit AgentBox Official Website
- Sign up and create your API Key
- Run your first model / prompt / agent inside the sandbox
Startup time is just a few seconds.
Example:
# pip install agentbox-python-sdk
from huggingface_hub import InferenceClient
from agentbox import Sandbox
import re
def match_code_block(llm_response: str) -> str:
"""
Extract python code inside a markdown code block.
Robust against variations like:
```python
...
```
or just
```
...
```
"""
pattern = re.compile(r"```(?:python)?\n(.*?)```", re.DOTALL | re.IGNORECASE)
match = pattern.search(llm_response)
if match:
return match.group(1).strip()
return ""
system_prompt = """You are a helpful coding assistant that can execute python code in a Jupyter notebook.
You are given tasks to complete and you run Python code to solve them.
Rules:
- ALWAYS FORMAT YOUR RESPONSE IN MARKDOWN
- ALWAYS RESPOND ONLY WITH CODE IN A CODE BLOCK LIKE THIS:
\`\`\`python
{code}
\`\`\`
"""
prompt = "Generate the first 15 Fibonacci numbers."
# Initialize the client
client = InferenceClient(
provider="hf-inference",
api_key="hf_......"
)
completion = client.chat.completions.create(
model="xxx/xxx", # Or use any other model from Hugging Face
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": prompt},
]
)
content = completion.choices[0].message.content
code = match_code_block(content)
sandbox = Sandbox(
api_key="ab_......",
domain="agentbox.cloud",
template="template_id"
)
execution = sandbox.commands.run(code)
print(execution)
๐ Try AgentBox
๐ Start your first sandbox here:
AgentBox Official Website
